Search code examples
pythonpip

How to make pip exit non-zero on incompatible dependency?


Sometimes I get such errors during pip install:

ERROR: A x.y.z has requirement B<1.0.0, but you'll have B 1.0.0 which is incompatible.

or

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. A x.y.z requires B<1.0.0, but you have B 1.0.0 which is incompatible.

My problem with this is that pip exits with a zero return value so this cannot be detected in a continuous integration system. The message ends with 'successfully installed...'. Is this a bug? How do I make pip exit with a non-zero status?

I am using pip 20 and 21.


Solution

  • I no longer have this issue on pip 24.