
Gael Varoquaux wrote:
I have just out-clevered myself using setuptools and virtualenv:
install foo using "python setup.py develop" (foo being ipython).
download some module bar you want to work on in an isolated environment
create this isolated environment using "virtualenv bar"
in the isolated environment "python setup.py develop" the bar module.
still in the isolated environment, try to import bar in a script installed by foo (aka ipython)
--> fails because foo uses the system python, and virtualenv wants you to use its own python
One very easy solution to make this work is to have the setuptools generated scripts use, under unices, "#!/usr/bin/env python" rather than "#!/usr/bin/python". This seems to me like a good solution, in general, to follow the user's expectations.
Is this a change that would be possible?
Sometimes you want to inherit the environment you've activated, but in my experience usually this isn't what you'll want. I find it easier to just reinstall any tools (like ipython, nose, etc) that I want to use in the virtualenv.
In an ideal situation they could share eggs with the system packages, but this only kind of works. (Sometimes, for reasons I don't always understand, easy_install will find and install globally-installed packages, creating an executable bound to the virtualenv.)
Ian