Why not virtualenv creating a bare environment?

I just started using virtualenv and it worked fine until yesterday. Now, and, it would seem, out of nowhere, it does not distinguish between my system environment and any env that I configured. For instance,

$ virtualenv some_env New python executable in some_env/bin/python Installing setuptools............done. Installing pip...............done. $ source some_env/bin/activate (some_env) $ yolk -l Box2D - 2.0.2b2 - active Django - 1.4 - active Fabric - 1.3.3 - active Markdown - 2.1.1 - active [...and so on, listing all my system installs] 

First of all, the yolk should not even work. Initially, I would install yolk in env, and it would only show about 5 packages. That's it.

Also, before anyone asks, I have the latest virtualenv version, so -no-site-packages is the default. I get the same results if I use this option explicitly.

What's going on here?

+4
source share
1 answer

virtualenv works by placing the bin folder in your virtualenv at the beginning of your PATH environment variable so that whenever you run python, it is redirected to a restricted python environment.

However, in your case, I suspect that the yolk script is probably set to /usr/local/bin/ or similar - which will still be available after virtualenv is activated. This script will most likely have a shebang at the top pointing to your global python interpreter, and therefore will work in your global python environment, and not in your virtualenv.

If you were to install yolk in your virtualenv, then this version of yolk script will take priority in the path and everything will work as expected.

+3
source

All Articles