Roman Susi
Roman Susi

Reputation: 4199

Pip ignores changed requirement

The requirements.txt file for a package under development contains something like:

git://git.gitsomewhere.com/MyProject.git@da39a3aaae6b4b0d3255bf5595601890afd80709#egg=MyProject

And it installs by

pip install -r requirements.txt

when there were no previous version.

However, when commit hash changes, pip will not update the dependency (happily reporting that requirement already satisfied).

Is there any way to reliably make pip fetch the right version, specified by commit hash (and maybe further confirmed by version in the setup.py of the fetched package)?

pip 8.1.2, for the record.

Upvotes: 0

Views: 275

Answers (1)

Roman Susi
Roman Susi

Reputation: 4199

It is possible to add editable project instead of installing into virtualenv by prepending the dependency line with -e:

-e git://git.gitsomewhere.com/MyProject.git@da39a3aaae6b4b0d3255bf5595601890afd80709#egg=MyProject

Another way, which may be preferable under some circumstances is to add (directly or into some more convenient path):

-e MyProject

and handle as git submodule. (see also Including Git submodules on pythonpath when using virtualenv )

One more way:

./MyProject

beware, previous solutions may be influenced by old installations.

NB, that pip install -r requirements.txt will update installation only if version in setup.py changed.

Before going with one solution or another, check how (and whether) it recovers from previously installed packages.

Upvotes: 1

Related Questions