pip install upgrade fail to upgrade private dependency

Viewed 360

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.

2 Answers

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.

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

Related