Question

When I attempt to add a Python package under development with distribute to a virtualenv via python setup.py develop, the system Python path (/usr/lib/python2.7/dist-packages on my Ubuntu 13.04 system) is automatically added to the virtualenv's easy-install.pth file. This seems to occur when the package under development has a dependency that is available in the system Python path even if it is also installed and active in the virtualenv. Is there some way to prevent python setup.py develop from adding the system Python path to easy-install.pth when a required package already is installed in the virtualenv? I want to avoid adding the system Python path to easy-install.pth because it confuses the distribute entry point mechanism of Python packages that are available both in the virtualenv and in the system Python path (e.g., ipython).

Was it helpful?

Solution

When you do

python setup.py develop

That ^ python that you are using to run setup.py is not necessarily associated with the virtual environment. You need to ensure that you are running the virtualenv's version of python by navigating directly to python.exe in your virtual environment and using that to run setup.py.

Alternatively you can just call activate.bat in your scripts folder and it will do it all for you, ensuring that nothing outside of the virtual environment is used.

edit if you are certain that you are using the virtualenv's python.exe please ensure that when you created the virtual env you used the --no-site-packages flag

virtualenv --no-site-packages myEnv

edit2 the --no-site-packages seems to have been OP's problem

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top