Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip unexpectedly not installing latest version of git package with branch/commit pinning

Tags:

git

python

pip

I have a requirements.txt file with the following line (among others):

git+https://github.com/lead-ratings/sexmachine.git@master#egg=SexMachine

When I do

pip install -r requirements.txt

I see

Requirement already satisfied (use --upgrade to upgrade): SexMachine from git+https://github.com/lead-ratings/sexmachine.git@master#egg=SexMachine in /home/myuser/virtual_env/lib/python2.7/site-packages (from -r requirements.txt (line 38))

And the package is not updated to the master version. Actually, it keeps some former version from PyPI I had listed in requirements.txt before.

It doesn't work either if I specify a commit in the pinning or use the --no-cache-dir flag. I'm using pip 6.1.1.

If I use the --upgrade flag then it works. But then what is the point of the pinning? Why does it say "Requirement already satisfied" if it really isn't?

like image 814
dukebody Avatar asked May 07 '15 14:05

dukebody


1 Answers

Pip decides whether a requirement is met solely based on the version number (in setup.py). In your case the pypi version you installed previously had the same version number as the master branch of sexmachine, so pip did nothing.

It seems that the way to handle this is to always pass the -U / --upgrade flag:

pip install -r requirements.txt -U

The maintainer's position is given in #2835:

The behavior of pip here is correct then, we don't determine the version number of the project/file, that comes from inside the package. If they want to support arbitrary tags being independently identifiable they should have their setup.py adjust itself based on that.

like image 110
Ryne Everett Avatar answered Nov 09 '22 06:11

Ryne Everett