# Issue with pip module

**URL:** <https://forum.ansible.com/t/issue-with-pip-module/12087>\
**Category:** Ansible Project\
**Created:** [November 14, 2012, 7:52pm UTC](https://forum.ansible.com/t/issue-with-pip-module/12087 "2012-11-14T19:52:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpmens1](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@jpmens1](https://forum.ansible.com/u/jpmens1)\
**Post date:** [November 14, 2012, 7:52pm UTC](https://forum.ansible.com/t/issue-with-pip-module/12087/1 "2012-11-14T19:52:24Z")

</div>

Hello,

I'm having a bit of trouble with the PIP module re-installing things  
that are there already...

When I try to install simplejson with the specified version (which is  
already installed), Ansible correctly indicates there's nothing to do  
and reports changed:false after a second or two.

> ansible -vvv -s -u vagrant sushi.mens.de -m pip -a 'name=simplejson virtualenv=/opt/graphite version=2.6.2'  
> \<127.0.0.1\> ESTABLISH CONNECTION FOR USER: vagrant on PORT 2222 TO 127.0.0.1  
> \<127.0.0.1\> EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1352922428.2-29240188583008 && chmod a+rx $HOME/.ansible/tmp/ansible-1352922428.2-29240188583008 && echo $HOME/.ansible/tmp/ansible-1352922428.2-29240188583008'  
> \<127.0.0.1\> REMOTE\_MODULE pip name=simplejson virtualenv=/opt/graphite version=2.6.2  
> \<127.0.0.1\> PUT /var/folders/jA/jA4IbxFXGJ0KSmsooRhDAU+++TI/-Tmp-/tmpZLk5mU TO /home/vagrant/.ansible/tmp/ansible-1352922428.2-29240188583008/pip  
> \<127.0.0.1\> EXEC sudo -k && sudo -p "[sudo via ansible, key=rlntvykrnnazqvfbultxotyewekrshvu] password: " -u root /bin/sh -c '/usr/bin/python /home/vagrant/.ansible/tmp/ansible-1352922428.2-29240188583008/pip; rm -rf /home/vagrant/.ansible/tmp/ansible-1352922428.2-29240188583008/ \>/dev/null 2\>&1'  
> sushi.mens.de | success \>\> {  
> &nbsp;&nbsp;&nbsp;&nbsp;"changed": false,  
> &nbsp;&nbsp;&nbsp;&nbsp;"cmd": null,  
> &nbsp;&nbsp;&nbsp;&nbsp;"name": "simplejson",  
> &nbsp;&nbsp;&nbsp;&nbsp;"requirements": null,  
> &nbsp;&nbsp;&nbsp;&nbsp;"state": "present",  
> &nbsp;&nbsp;&nbsp;&nbsp;"version": "2.6.2",  
> &nbsp;&nbsp;&nbsp;&nbsp;"virtualenv": "/opt/graphite"  
> }

On the other hand, if I try to install 'carbon', Ansible reports  
changed:true every time: PIP actually downloads and installs this  
module.

> ansible -vvv -s -u vagrant sushi.mens.de -m pip -a 'name=carbon virtualenv=/opt/graphite version=0.9.10'  
> \<127.0.0.1\> ESTABLISH CONNECTION FOR USER: vagrant on PORT 2222 TO 127.0.0.1  
> \<127.0.0.1\> EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1352922255.75-155038840306131 && chmod a+rx $HOME/.ansible/tmp/ansible-1352922255.75-155038840306131 && echo $HOME/.ansible/tmp/ansible-1352922255.75-155038840306131'  
> \<127.0.0.1\> REMOTE\_MODULE pip name=carbon virtualenv=/opt/graphite version=0.9.10  
> \<127.0.0.1\> PUT /var/folders/jA/jA4IbxFXGJ0KSmsooRhDAU+++TI/-Tmp-/tmpJH7FuX TO /home/vagrant/.ansible/tmp/ansible-1352922255.75-155038840306131/pip  
> \<127.0.0.1\> EXEC sudo -k && sudo -p "[sudo via ansible, key=tbyegozfrhfhsgmiagpetvlmblwfarvk] password: " -u root /bin/sh -c '/usr/bin/python /home/vagrant/.ansible/tmp/ansible-1352922255.75-155038840306131/pip; rm -rf /home/vagrant/.ansible/tmp/ansible-1352922255.75-155038840306131/ \>/dev/null 2\>&1'  
> sushi.mens.de | success \>\> {  
> &nbsp;&nbsp;&nbsp;&nbsp;"changed": true,  
> &nbsp;&nbsp;&nbsp;&nbsp;"cmd": "/opt/graphite/bin/pip install carbon==0.9.10 --use-mirrors",  
> &nbsp;&nbsp;&nbsp;&nbsp;"name": "carbon",  
> &nbsp;&nbsp;&nbsp;&nbsp;"requirements": null,  
> &nbsp;&nbsp;&nbsp;&nbsp;"state": "present",  
> &nbsp;&nbsp;&nbsp;&nbsp;"version": "0.9.10",  
> &nbsp;&nbsp;&nbsp;&nbsp;"virtualenv": "/opt/graphite"  
> }

Is this the fault of Ansible's PIP module, Python PIP, or is it due to  
how the 'carbon' module is defined/built/packaged.

Anybody have a clue?

Thanks,

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-JP

---

<div class="post-metadata">

**Author:** ![Sam\_Solomon](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Sam\_Solomon](https://forum.ansible.com/u/Sam_Solomon)\
**Post date:** [June 17, 2013, 10:00pm UTC](https://forum.ansible.com/t/issue-with-pip-module/12087/2 "2013-06-17T22:00:24Z")

</div>

This is a really old thread, but wondering if anyone had any solutions for this issue.

Encountered with both requirements.txt and an individual package:

```auto
- name: install requirements
  sudo: no
  pip:
    requirements: /srv/<project>/requirements.txt
    virtualenv: /home/sam/.virtualenvs/<project>/

- name: install raven
  sudo: no
  pip:
    name: raven
    version: 1.9.4
    virtualenv: /home/sam/.virtualenvs/<project>/

```

with ansible-playbook -vvv for the simpler case of installing raven, though both outputs contained reinstalling simplejson (then made readable with print and hand editing):

```auto
changed: [<hostname>] =>
{
  "changed": true,
  "cmd": "/home/sam/.virtualenvs/<project>/bin/pip install --use-mirrors raven==1.9.4",
  "item": "",
  "name": "raven",
  "requirements": null,
  "state": "present",
  "stderr": "",
  "stdout": """Requirement already satisfied (use --upgrade to upgrade):
    raven==1.9.4
    in home/sam/.virtualenvs/<project>/lib/python2.7/site-packages
  Downloading/unpacking simplejson>=2.3.0,<2.5.0 (from raven==1.9.4)
  Running setup.py egg_info for package simplejson

Installing collected packages: simplejson
  Found existing installation: simplejson 2.5.2
    Uninstalling simplejson:
      Successfully uninstalled simplejson
  Running setup.py install for simplejson
    building 'simplejson._speedups' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG \
      -g -fwrapv -O2 -Wall -Wstrict-prototypes \
      -fPIC -I/usr/include/python2.7 -c simplejson/_speedups.c \
      -o build/temp.linux-x86_64-2.7/simplejson/_speedups.o
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions \
      -Wl,-Bsymbolic-functions \
      -Wl,-z,relro build/temp.linux-x86_64-2.7/simplejson/_speedups.o \
      -o build/lib.linux-x86_64-2.7/simplejson/_speedups.so

Successfully installed simplejson
Cleaning up...""",
  "version": "1.9.4",
  "virtualenv": "/home/sam/.virtualenvs/<project>"}

```

This is after:

```auto
$ /home/sam/.virtualenvs/<project>/bin/pip install --use-mirrors raven==1.9.4
Requirement already satisfied (use --upgrade to upgrade):
  raven==1.9.4 in
    /home/sam/.virtualenvs/<project>/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade):
  >=2.3.0,<2.5.0 in
    /home/sam/.virtualenvs/<project>/lib/python2.7/site-packages
      (from raven==1.9.4)

```

Also:

$ ansible-playbook --version  
ansible-playbook 1.2
