-
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
Backtracking when package has conflicting runtime dependencies #10719
Comments
This is kind of similar to #10655, but instead of a build failure, the build (building a wheel = no-op) “succeeds” but produces an internally inconsistent result. The inconsisntency can be catched, but the problem is what pip should do when this happens. |
install_requires
I don't see how this is related to #10655. This is basically equivalent to:
(A is oldest-supported-numpy, B is numpy) Here, pip is backtracking on the first conflict and moving on to the second item. The only sort of thing that can help here is #10258, but even then, this isn't going to be something that errors out explicitly. |
Judging from the original issue title, what OP wants is for pip to not look for A 1.0 when A 2.0 fails to resolve, but fail immediately. #10258 (as it is implemented right now) does not help this, because there are no conflicts in the end result; the key thing that needs to change is, when A 2.0 fails, the resolver needs to stop instead of backtracking, which is the same-ish expectation in #10655. |
But there's never a "failure" -- at least, as I use that in my vocabulary? #10655 is about a failure during metadata generation (i.e. a subprocess call or whatever). It does not deal with changing behaviour around inconsistent metadata or even the properly formed but not-actually-sane metadata. This issue falls in the last category. You have valid metadata (i.e. that can be read, parsed and processed) but that would never generate a proper result.
Yes, but... the main difference is what the level of the issue is. The situation in #10655 is that the package doesn't build metadata successfully. The situation here is that a package has an unsatisfiable runtime dependencies on one version and a satisfiable set on other versions. This is almost definitionally the case where the resolver needs to backtrack, as I understand it, so... 🤷🏽 If you're suggesting is that pip have some hueristic to detect "bad" package dependency declarations and fail / warn on those versions... I don't like that but I also don't hate it? It does sound like something that would involve a decent amount of complexity/work to figure out and only be genuinely better in some edge cases like this, with a risk of having unintended effects (depending on the heuristic, obviously). This heuristic can't be something like "disallow backtracking on 'top-level' packages" or whatever -- not least because I'm pretty sure a decent chunk of our tests involve backtracking on a 'top-level' package. If all we want is presentation of dependency conflicts, then #10258 cover this and we can fold this issue into #9254. |
I'm afraid1 I agree with @pradyunsg here. How is the situation here any different than a package with a dependency on Yes, the case of depending on But the OP's case wasn't a simple one. The quoted requirements were:
That's not something you're going to be able to validate in advance.
One thing we could potentially do is in I don't think we should do anything if our standard handling of Footnotes
|
For the specific case of this package, they actually can -- scipy/oldest-supported-numpy#34 |
OK, for a given set of supported environments. That's a very good approach, but something only the individual project can do, which I agree is the correct solution here. My comment was more about the backend doing the validation at build time, not the project itself. |
Likewise.
I tend to agree, however, I'm still not sure that we should trigger an error condition here (i.e. fail the entire resolution process) instead of just presenting a message. And, presenting a message is covered by #9254. |
Yup yup. I didn't intend to imply that you meant otherwise. :) |
Alright. oldest-supported-numpy is now covered, thanks to scipy/oldest-supported-numpy#35. Is there really anything actionable here, or can we fold this into #9254? |
Just for the record, in my case a simple warning would have been satisfactory. The problem was being unable to easily diagnose the issue, since pip was doing something totally unexpected without saying anything about it (and since multiple packages were involved, finding the root cause wasn't trivial). |
Description
The
oldest-supported-numpy
package version 0.13 has conflicting requirements in its setup.cfg:https://github.com/scipy/oldest-supported-numpy/blob/v0.13/setup.cfg#L43-L50
Those two lines conflict on s390x and Python 3.8:
When copying those directly in a requirements file, you get the expected error:
However, when installing said package, pip silently downgrades the package to the previous version without conflicting requirements:
It should at least display a warning about the unexpected downgrade (or perhaps better, error out).
Expected behavior
No response
pip version
21.3.1
Python version
3.8.10
OS
Ubuntu 20.04.3
How to Reproduce
See description above.
Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: