9000
9000

Reputation: 40894

easy_install 'develop' command fails to work in virtualenv

Update:

It turns out that the virtualenv was not properly initialized before running easy_install. Once this has been rectified, things started to work as intended. There's no solution to post, since the stated problem did not exist in the first place. The 'when I activate the virtualenv' step was not properly taken (don't ask), so the following malfunction was an illusion.

Case closed.

Original question:

I have a virtualenv. Inside it, sys.path looks like this:

[...,
 '/<inside_virtualenv>/lib/python2.6/site-packages/foo-1.2.egg',
 ...
 '/usr/local/lib/python2.6/dist-packages/foo-2.0.egg'
]

If I import foo from inside the virtualenv, I get foo-1.2 imported, as expected.

I have an egg; its setup file lists another egg as a dependency that has foo=1.2 in its dependencies.

When I activate the virtualenv and try to run python <my_egg>/setup.py develop, I get an error:

Processing dependencies for <my egg>
Installed distribution foo 2.0 conflicts with requirement foo==1.2

I even patched setuptools/command/easy_install.py to print sys.path right inside the try statement that raises this exception. The path is all right, listing foo-1.2 first and foo-2.0 distant second.

What am I doing wrong? Is there any way to make easy_install ignore the non-virtualenv foo-2.0 installation and accept foo-1.2 inside the virtualenv?

Removing the offending entry from sys.path inside my egg's setup.py does not help. While sys.path only contains the correct version of foo, the process fails with the same error.

Upvotes: 1

Views: 417

Answers (1)

Charles Duffy
Charles Duffy

Reputation: 295629

There's another possible case where this can happen, beyond the one you were experiencing directly, but which is easily avoided:

When setting up a new virtualenv, use --no-site-packages to avoid including libraries from your system Python installation unless you're certain they don't (and will never) conflict.

Upvotes: 2

Related Questions