Search code examples
virtualenvpip

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


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/django-debug-toolbar.git@9067568b0bbf0c39322f5b761b05463685355b4f#egg=django_
debug_toolbar-dev
-e hg+https://bitbucket.org/ubernostrum/django-registration@fad7080fe76955e7d0d3c97bc468ea8360260a6b#egg=django_registration
-dev
-e git://github.com/yourcelf/django-registration-defaults.git@df80e13fd5f4ee3c96d4508fa12278c47c660c37#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??


Solution

  • 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