Installing pip packages into a virtualenv - where are they?

I’m running ansible stable-1.9 (from git)

I have a playbook task which looks like this:

  • name: Install virtualenv

easy_install: name=virtualenv executable=easy_install

  • name: Setup pip packages
    pip: name={{item}} virtualenv=/home/ec2-user/scrapy virtualenv_command=virtualenv executable=pip virtualenv_site_packages=yes extra_args=“–allow-external”
    with_items:
  • scrapy
  • pika

When I run the playbook I see:

TASK: [Install virtualenv] ****************************************************

ok: [ec2-54-78-26-101.eu-west-1.compute.amazonaws.com]

TASK: [Setup pip packages] ****************************************************

ok: [ec2-54-78-26-101.eu-west-1.compute.amazonaws.com] => (item=scrapy)

ok: [ec2-54-78-26-101.eu-west-1.compute.amazonaws.com] => (item=pika)

PLAY RECAP ********************************************************************

ec2-54-78-26-101.eu-west-1.compute.amazonaws.com : ok=5 changed=0 unreachable=0 failed=0

However when I log into the server and activate the virtualenv I see none of the packages that ansible reports as installed:

$ source scrapy/bin/activate

(scrapy)[ec2-user]$ pip freeze

(none of the installed packages are listed)

What is really strange is that the packages don’t seem to be anywhere on the server i.e

$ cd /
$ sudo find . | grep -i pika
$

What am I missing here?

As a follow up, it seems if I drop the extra_args parameter some packages are installed, except of course those packages that need the --allow-external flag. However when using this flag everything is reported as installed successfully but it seems the packages are actually skipped. Is this a known bug? I’m using 1.9.1 but I also tried the latest head code and got the same

I got to the bottom of this:

I forgot to add the package name to allow-external i.e.

extra_args=“–allow-external mysql-connector-python”

Now everything works as expected. I would still suggest that there is a (minor) bug if ansible reports a package is successfully installed when in fact it is not. What do you guys think?

Toby, not really a reply to your searches but just an idea:
why not bootstrap pip via get-pip.py (https://bootstrap.pypa.io/get-pip.py) and then use pip to install virtualenv and anything else?
-Y.