Issue with pip module

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 >> {
    "changed": false,
    "cmd": null,
    "name": "simplejson",
    "requirements": null,
    "state": "present",
    "version": "2.6.2",
    "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 >> {
    "changed": true,
    "cmd": "/opt/graphite/bin/pip install carbon==0.9.10 --use-mirrors",
    "name": "carbon",
    "requirements": null,
    "state": "present",
    "version": "0.9.10",
    "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,

        -JP

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:

- 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):

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:

$ /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