Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PIP always reinstalls package when using specific SVN revision

PIP always downloads and installs a package when a specific SVN revision is specified (slowing the syncing process considerably).

Is there a way around this? Normally pip detects that the package is already installed in the environment and prompts to use --upgrade.

My pip_requirements file has the following line:

svn+http://code.djangoproject.com/svn/django/trunk/@16406#egg=Django1.4A

Thanks for your help!

Answer

  • Must specify egg name as exact python package name.
  • Must not use -e flag.
  • Does not work on PIP version 0.7, works on 1.0.2.
like image 248
Yuji 'Tomita' Tomita Avatar asked Nov 01 '11 19:11

Yuji 'Tomita' Tomita


1 Answers

I was actually hacking around pip this past weekend and I believe I have the explanation to your pip woes. The problem is just a limitation within pip itself. Due to the way the installation process works the #egg=[egg-name] portion must be named correctly to the actual project's name identified within the setup.py's name kwarg (this is the name known on PyPI).

Short Answer

Your line:

svn+http://code.djangoproject.com/svn/django/trunk/@16406#egg=Django1.4A

Should be:

svn+http://code.djangoproject.com/svn/django/trunk/@16406#egg=django

Long Answer

The install process actually does the following to my understanding (Ian Bicking strike me down if I'm wrong :-P)

  1. When it gets your requirement it determines that the link is to a VCS it knows based on the vcs+[url] structure.
  2. It checks out the code into a temporary directory within your environment.
  3. It runs the setup.py (I believe both egg_info and install)
  4. Temporary directory for checked out code is removed from the filesystem

So once step 3 has completed and your checked out source has installed, Django is known to pip as django (case-insensitive). However, if you keep your current requirements line, pip will search for for Django1.4A. Not finding a package matching that name, it will checkout the source code again and attempt to install it.

like image 156
ravenac95 Avatar answered Sep 30 '22 18:09

ravenac95