Python package install using pip to source doesn't create a symlink

Tag: virtualenv , pip Author: zhenuc Date: 2011-10-12

So I'm a convert with pip and virtualenv. One of the things I've found is that when I use a requirements.txt with contents which look like this the subsequent pip -E -r requirements.txt works as intended..

PIL==1.1.7
chardet==1.0.1
distribute==0.6.14
django-extensions==0.6
django-profiles==0.2

But when you start getting fancy with your requirements.txt by pulling source trees, the following behavior is seen. 1) It pull the source into "source" tree. (That's good) 2) It fails to create a symlink to this in the site-packages tree but rather create *.link (.ie django-debug-toolbar.egg-link )

-e git+https://github.com/django-debug-toolbar/[email protected]f#egg=django_
debug_toolbar-dev
-e hg+https://bitbucket.org/ubernostrum/[email protected]#egg=django_registration
-dev
-e git://github.com/yourcelf/[email protected]47c660c37#egg=django_registrati
on_defaults-dev

The problem is that now I have to create the symlink to the source tree from the site-packages tree. To fix this I shift over to the site-packages tree and start creating symlinks back to the sources tree.

I'm sure there is a better way to do this - can someone please enlighten me??

Best Answer

You don't have to create a symlink at all, the so called *.egg-link files in the site-packages directory of the virtualenv will act as a symlink on Python (well, actually setuptools) level.

EDIT: I added a bit of background info here: http://github.com/pypa/pip/issues/435

comments:

Do you know how that works? Is that an idiom of setuptools? Nevermind - your answer here (github.com/pypa/pip/issues/435) provided all the necessary links! Awesome