pip install upgrade fail to upgrade private dependency

天涯浪子 提交于 2021-02-08 07:42:37

问题


background: pip support ssh link suffix with

  1. branch name,
  2. a commit hash,
  3. a tag name
  4. a git ref

However, pip has a problem in upgrade some package depends on these ssh links.

in a setup.py of a package called CurrentPackage that is version 5.1.2

install_requires=[
    "MyOwnPackage @ git+ssh://git@github.com/myusename/MyOwnPackage@master",
],

i then pip install --upgrade -e .

Requirement already satisfied, skipping upgrade: 
MyOwnPackage@git+ssh://git@github.com/myusename/MyOwnPackage@master from 
git+ssh://****@github.com/myusename/MyOwnPackage@master in 
/opt/anaconda3/lib/python3.8/site-packages (from CurrentPackage==5.1.2) (0.0.1)

The master branch is already 0.0.2. It clearly didn't upgrade MyOwnPackage to the new master branch commit, still staying at 0.0.1.


回答1:


pip does not check if a remote reference has been changed between installs. This means that pointing to a moving reference (like you have here) does not work as expected.

I'd suggest using:

  • specific commit hashes or tags, that are modified when you want to make upgrades
  • invoking pip with --upgrade to tell it to look around eagerly.
  • convert these packages into proper distributions and use --find-links or --index-url with that.



回答2:


Ok , I conclude that it is pathetic to list the private dependency in setup.py since the syntax must be

packagename @ git+ssh://git@github.com/myusename/packagename

simply put

-e git+ssh://git@github.com/myusename/MyOwnPackage==0.0.2

in requirements.txt



来源:https://stackoverflow.com/questions/65969279/pip-install-upgrade-fail-to-upgrade-private-dependency

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