PIP hg+ and git+ always downloads package instead of detecting satisfied requirement

喜夏-厌秋 提交于 2019-12-11 11:33:33

问题


My other question here just got answered about why pip svn+ was always re-downloading entire packages.

Now I have a handful more packages in my pip_requirements file that always get downloaded instead of detecting that the package requirements are satisfied.

They are the following types:

  • git+git://github.com/yuchant/django-jinja2.git
  • hg+https://bitbucket.org/yuchant/django-storages

With svn+ my packages are detected as satisfied regardless of whether I specify trunk or a specific revision. Is the pattern different for git and mercurial?


回答1:


Short Answer

When using any VCS with pip requirement files you should always specify using #egg=[egg-name]

So your requirements file should contain:

git+git://github.com/yuchant/django-jinja2.git#egg=django-jinja2
hg+https://bitbucket.org/yuchant/django-storages#egg=django-storages

Long Answer

If you specify the pip requirements just like you do in your question without the #egg=[egg-name]. I'm going to call that string the egg identifier. The problem is very similar to your last question. Pip uses the egg identifier to search the currently installed python modules.

This is what happens if an egg identifier isn't specified:

  1. Pip searches for git+git://github.com/yuchant/django-jinja2.git in the installed modules
  2. Pip doesn't find it so it attempts to install it again

If you use an egg identifier this won't have this problem.



来源:https://stackoverflow.com/questions/8825297/pip-hg-and-git-always-downloads-package-instead-of-detecting-satisfied-require

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