Wednesday 18 March 2009

pip and virtualenv differences (--no-site-packages)

Just a quick note here found when debugging multiple django installs.

There is a difference between:
> virtualenv foo
> pip install -E foo Django

and
# no virtualenv exists at this point
> pip install -E foo Django

Basically, if pip creates a new virtualenv, it always does it using the '-no-site-packages' option. This isn't so good for things like cx_Oracle, where we already have rpms and it's pretty hard to get it to auto-build on install. Testing this, I ran into yolk - which shows you the list of packages:
# no virtualenv exists at this point
> virtualenv foo
> pip install -E foo yolk
> source foo/bin/activate
(foo)> yolk -l
Python - 2.5.2 - active development (/usr/lib64/python2.5/lib-dynload)
cx_Oracle-py25 - 4.4.1 - active development (/usr/lib64/python2.5/site-packages)
pip - 0.3.1 - active development (/usr/lib64/python2.5/site-packages/pip-0.3.1-py2.5.egg)
setuptools - 0.6c9 - active
setuptools - 0.6c9 - active
setuptools - 0.6c9 - non-active development (/usr/lib64/python2.5/site-packages/setuptools-0.6c9-py2.5.egg)
setuptools - 0.6c9 - non-active development (/usr/lib64/python2.5/site-packages/setuptools-0.6c9-py2.5.egg)
virtualenv - 1.3.3 - active development (/usr/lib64/python2.5/site-packages/virtualenv-1.3.3-py2.5.egg)
wsgiref - 0.1.2 - active development (/usr/lib64/python2.5)
yolk - 0.4.1 - active

Here you can see a cx_Oracle which is inherited correctly from the default environment.

No comments: