Jamey
Jamey

Reputation: 4620

Why isn't virtualenv creating a bare environment?

I just started using virtualenv, and it was working normally until yesterday. Now, and seemingly out of nowhere, it doesn't distinguish between my system environment and any env I set up. For example,

$ 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, yolk shouldn't even be working. Originally, I'd install yolk to the env, and it would only show about 5 packages. Now it's everything.

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

What's going on here?

Upvotes: 4

Views: 409

Answers (1)

obmarg
obmarg

Reputation: 9559

virtualenv works by putting the bin folder in your virtualenv at the start of your PATH environment variable so that whenever you run python it reroutes to a limited python environment.

However in your case, I suspect the yolk script is probably installed to /usr/local/bin/ or similar - which will still be accesible after activating the virtualenv. This script will likely have a shebang at the top pointing to your global python interpreter and therefore will run in your global python environment rather than your virtualenv.

If you were to install yolk in your virtualenv then that version of the yolk script would get priority in the path and everything would work as expected.

Upvotes: 3

Related Questions