I am wondering about this command pip install -r requirements.txt
. Does pip install modules if they are not satisfied or does it try and install anyway even if the modules are already there? If it is the latter, than is there any way to write a shell script which checks if dependencies are satisfied and if not invoke pip install?
Asked
Active
Viewed 2,389 times
2

mrQWERTY
- 4,039
- 13
- 43
- 91
-
Relevant: [Check if requirements are up to date](http://stackoverflow.com/questions/22944861/check-if-requirements-are-up-to-date). – alecxe Jul 25 '14 at 16:45
1 Answers
4
Pip only installs packages that are not installed yet.
This does mean that even if a new version is available, old packages will be kept. You can pass the --upgrade
flag to prevent that behavior and install the latest versions (but then pip will call pypi for every package in your requirements file, in order to identify its latest version).
An alternative is to have version specifiers in your requirements file (e.g. mypackage==1.2.3
), so that if you change your requirements file and use new versions, pip will pick those up without the --upgrade
flag.

Thomas Orozco
- 53,284
- 11
- 113
- 116