-
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
pip Dependency Resolver Selects Incompatible Package Version Leading to Installation Failure for AutoGluon #12990
Comments
I am going to take a look at why there was a change (it was almost certainly something that happened in the dependency tree, there hasn't been a pip release since July). But first, to be clear, it's not possible to tell if an sdist is compatible unless pip tries to build it, and if the build failure happens pip takes that as an indication that the user does not have the requirements to install and exits backtracking. The best practice suggestion is, in general, to add good lower bounds. Is that something you can do for your project? Add a good lower bound on P.S. I believe there has been discussions about allowing packages to publish static metadata for sdists, but I'm not familiar where that idea has got to and if there's much traction on going forward with it, and I think it would require projects to opt in. Also, uv does a trick where it assumes the dependency is the same across all wheels and sdists for a given release and reads the dependency metadata out of a wheel, this is not something pip is likely ever to do. |
Nothing has changed with pip since this Tuesday. Are you able to confirm which is the first version of pip to exhibit this behaviour? I tried pip 23.1 and, while it appears to take a different route through the dependency tree, it ultimately still arrives at onnx 1.10.0 and fails. As a comparison, I tried with the legacy resolver. It installed, but failed
I also tried (This was on Windows with Python 3.11, FWIW). I don't know what might be wrong here. Maybe @notatallshaw can help, as he's done a lot of work on complex resolution issues. |
(Whoops, @notatallshaw - our messages passed in the ether 🙂) |
😄
Note my comment on a trick uv does which helps it avoid trying to build incompatible sdists:
It might not be doing that here, but it could be. uv takes a different resolution path as it has different backtrack priorities (and in general they are a little lacking compared to pip's, but that could also be the difference here). |
Assuming consistent metadata could indeed be affecting things - good catch! As you say, that's not something pip is going to do. I guess it's possible that if pip had been able to build the failing version(s) of onnx, we would also have ultimately arrived at a valid resolve. But we rely on being able to get metadata, unlike uv we don't ever assume it.
This exists - it's metadata 2.2 (specifically, the "Dynamic" metadata item). But adoption of metadata 2.2 was delayed because PyPI didn't support it for some time, and so build backends didn't produce it. And pip doesn't have support yet because there's little point until packages start including it. It wouldn't help in this case, though, as only new uploads will have modern metadata. Ultimately, onnx needs to fix that broken sdist, though. |
Thank you for your prompt reply. Considering the absence of recent releases on pip, the issue might be linked to the other package releases in our dependency trees, possibly causing the later versions of onnx to be incompatible. Could you advise me on how to identify the problematic package during the installation process? I tried |
That is what I somewhat feared. The AutoGluon dependency tree is more complex than most packages, since it is an AutoML system with many large dependencies that themselves have complex dependency trees. For So I suppose even though we don't explicitly depend on onnx, we need to include it in our setup.py with version ranges whenever we also install |
Here's what I've found so far: Pip gets confused by the dependency chain If you add constraints on The good news is pip will be able to resolve this correctly and fast once #12317 lands (or at least the extracted logic from it). The bad news is that it's waiting on a vendor from resolvelib, and that vendor from resolvelib will initially make pip very slow at this resolution (due to correctness bug fixes), so once the vendor does happen I will push for the associated changes to make resolution quicker again. Also, I might have a simpler idea to fix this kind of complicated resolution than the ones in #12317 that could help here, I will test once I get a chance (probably in a few days). |
Thank you for taking the time to investigate this issue. I can verify that downgrading the spaCy version to 3.7.5 is effective for us. To unblock the installation of all released AutoGluon versions without having to release a new one with a pinned upper limit on spaCy, could spaCy potentially lower its |
I don't know, you need to talk to spaCy why they have such a tight requirement on thinc. As a library being tightly coupled to the versions of a dependency will inevitably cause resolution problems for users of that library, e.g. if two high level data science libraries have tight dependencies on numpy and they are different versions, then a user can never install both high level data science libraries. In other news, I have found a way to improve pip to handle this resolution much better without too complicated of a change: #12993. I hope to make a PR within a few days. |
We have cut an issue to spaCy to see if they can relax their version requirements on thinc and patch a release |
Any update on the status for the fix and release? We are evaluating if we should perform a patch release to unblock users depends on how soon the issue can be resolved |
I rate the chances of making the Pip 24.3 release as possible but low. Changes to the resolver preference should ideally come with a lot of evidence that they are a net benefit, I am working on building a script that can automatically run a series of scenarios and give and objective measurement if this change made a difference. If I can get it ready in time and if it's convincing enough that it's a high benefit low risk change to the pip release manager then it will get in. Otherwise it will have to wait till pip 25.0 (scheduled for January 2025). |
Description
Starting around this Tuesday (10/01/2024), we got reports from users on installation failure of AutoGluon on previous working releases. When installing
autogluon==1.1.1
using pip, the dependency resolver selects an older version of onnx (1.10.0), which fails to build due to missing files (specifically requirements.txt). Previously, pip would select a compatible version of onnx (e.g., 1.16.2 or 1.17.0), and the installation would succeed without issues. Meanwhile, we noticed thatuv pip install autogluon==1.1.1
andpip install autogluon==1.1.1 --use-deprecated=legacy-resolver
works as expected.This change in behavior suggests a potential issue with the dependency resolution in pip, possibly related to recent updates either in pip itself or in one of the transitive dependencies. After some deep dive on our side, we are not able to pinpoint the root cause of the issue and would like to seek guidance from pip community for help. Any pointers would be appreciated
Expected behavior
pip version
24.2
Python version
3.8, 3.9, 3.10, 3.11
OS
Linux x86_64/ARM, macOS Intel/ARM
How to Reproduce
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: