-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-zero exit code for ERROR: pip's dependency resolver does not currently take into account all the packages that are installed? #10380
Comments
Unfortunately there are way too many people depending on pip returning 0 in this case, we can’t just change it. The return code predates the message by a loooooong time. |
Now that people use Docker extensively and relying on Docker layers caching heavily, installing dependencies in multiple steps is normal. But installing broken transitive dependencies silently is probably not normal. I do understand that |
Also, maybe stressing out in
P.S. Sorry my ignorance. May be the things I am asking/suggesting is known for ages, but I've just couldn't find them before reporting. Also, bumping into the reported problem after years of Python devepoment was kind of surprising, showing that I don't really understand how pip deps resolution works internally |
As @uranusjr noted, the contract pip has had for many years is that
This functionality is already exposed -- it's the |
thanks for the clarifications!
This is exactly what I've ended up with. |
I am curious about this. What scenario are using using Docker, and rebuild from a cached layer, and want to use pip to install packages into a conflicting environment? The idea of building with containers (to my understanding) is so the build can be deterministically reproduced from scratch, and installing multiple requirement files without resolving the conflicts between them seems to defeat the purpose. Could you elaborate more on the concrete use case here? |
I don't. I just didn't know that after:
I need to |
Coolieo. I’m gonna consolidate this into #9094 now; I think the intended next steps are documented there, and you’ve got a working setup until then. :) |
Description
I've got two packages:
A
(with transitive dependencyB<N
) in requirements filefirst.txt
C
(with transitive dependencyB>N
) in requirements filesecond.txt
So basically the transitive dependencies for both
A
andC
are the same package but of conflicting versions.If I do the following:
pip install --no-cache-dir -r first.txt
pip install --no-cache-dir -r second.txt
I do:
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.
instderr
when installingsecond.txt
pip install
successfully installs conflicting transitive dependencyB>N
pip install
also returns exit code 0Expected behavior
pip install --no-cache-dir -r second.txt
should throwERROR: ResolutionImpossible
and returns exit code 1 (or whatever non-zero code it should return).Another (less attractive than the previous one) option would be just returning non-zero exit code for
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed
. Because it's an error, not a warning.pip version
21.2.4
Python version
3.9.6
OS
Ubuntu 21.04, Alpine 3.14
How to Reproduce
My setup is a virtualenv with the following versions:
The content of the requirement files:
Steps to reproduce:
pip install --no-cache-dir -r first.txt
pip install --no-cache-dir -r second.txt
echo $?
pip check
Output
Installing the second requirement file
All in all, the
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.
is thrown tostderr
, but exit code is 0 and installation is successful.I do understand that error says precisely that the pip couldn't properly resolve as not all package versions being taken into consideration. But still it is not a warning, but an error, so why exit code is 0?
Also,
pip check
does detect the problem after the installation.By the way, for some cases if no
--no-cache-dir
option is used, pip throws properERROR: ResolutionImpossible
, although I cannot reproduce the behaviour for the current exemple requirement files.If both requirements combined into one, then resolution confict is detected correctly, non-zero exit code is returned as expected:
Code of Conduct
The text was updated successfully, but these errors were encountered: