Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(Re)Checking Dependencies with PIP

Is it possible to re-check the dependencies of packages installed with pip? That is, suppose we have a working environment. Then, one of the packages changes (gets upgraded, etc). Is there a command one can run to make to make sure that the dependency tree is still sound and does not have conflicts?

like image 755
MadPhysicist Avatar asked Apr 26 '17 00:04

MadPhysicist


People also ask

How do I check the dependencies of a pip package?

Pip Check Command – Check Python Dependencies After Installation. Because pip doesn't currently address dependency issues on installation, the pip check command option can be used to verify that dependencies have been installed properly in your project. For example: $ pip check No broken requirements found.

What is pip dependency resolver?

pip is capable of determining and installing the dependencies of packages. The process of determining which version of a dependency to install is known as dependency resolution. This behaviour can be disabled by passing --no-deps to pip install.

Does pip install dependencies of dependencies?

Pip will not flag dependency conflicts. As a result, it will happily install multiple versions of a dependency into your project, which will likely result in errors.


2 Answers

Nowadays python -m pip check should do the trick.

Seems to have been added as early as pip 9.0.0 released on 2016-11-02.

like image 62
sinoroc Avatar answered Sep 27 '22 02:09

sinoroc


It's not part of pip, but there is a tool you can use called pip-conflict-checker. Just install it through pip and run pipconflictchecker to get a dump of all the conflicts. pipdeptree could also help here.

You might also be interested in reading this article about dealing with pip dependency issues. The article also discusses the two tools I mentioned above along with strategies to fix broken dependencies.

like image 26
kalebo Avatar answered Sep 27 '22 02:09

kalebo