virtualenv site-packages problem on OS X

2

I am using a MacPorts installation of Python2.7. I have used pip to install a number of packages in my home directory (pip install --user). The issue is that when I use virtualenv, none of those packages make it to the new virtual environment. I know it's probably because virtualenv doesn't look at the packages installed in my home dir when making the new environment.

I have been searching for a virtualenv option to make it see those packages as well, but no luck. Am I missing something or will I need to install the packages globally after all to make virtualenv see them?

Example:

pip freeze

> Django==1.3.1
> MySQL-python==1.2.3
> PIL==1.1.7
> virtualenv==1.6.4
> wsgiref==0.1.2

source workingEnv/bin/activate
pip freeze

> wsgiref==0.1.2

Jibran

Posted 2011-09-10T10:32:01.153

Reputation: 196

Which directory are you in and which pip is used? – user151019 – 2011-09-10T12:16:44.543

I'm in ~/Desktop and the pip is the file that is installed with the MacPorts easy_install. – Jibran – 2011-09-10T13:06:54.077

How do you make the virtual environment - as some parameters will not copy anything from site-packages. - Also for MySQL I find it easier to use macports to install that rather than easy_install – user151019 – 2011-09-10T13:16:30.793

virtualenv workingEnv

however, those packages are installed in my home dir [~/Library/Python/2.7/lib/python/site-packages], not in my main site-packages. – Jibran – 2011-09-10T13:41:30.960

Answers

0

virtualenv only copies from the global site-packages and not your local ones so I would either use macports to install all these needed packages or install them into the global install. An alternative is to create a bootstrap script that can add to PYTHONPATH to pick up these python packes in you home directory.

user151019

Posted 2011-09-10T10:32:01.153

Reputation: 5 312