PIP always reinstalls package when using specific SVN revision

扶醉桌前 提交于 2019-12-04 19:51:25

问题


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.

回答1:


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.



来源:https://stackoverflow.com/questions/7971799/pip-always-reinstalls-package-when-using-specific-svn-revision

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!