-
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 resolver installing incompatible versions #10081
Comments
The error message explains why that occurs. Changing this behaviour is tracked in #9094. Consolidating this issue into that. |
@pradyunsg I think this one might be a bit different, since there’s only one pip install command and nothing was installed previously (fresh venv). |
I can reproduce this in a fresh virtual environment. This is very weird. I suspect there is a package doing funky things to bypass the resolver and install its own things. |
Hmm. So the resolver has no trouble understanding certifi needs to be pinned. It first fetches 2021.5.30 because requests needs
And then correctly triggers a downgrade when snowflake-connector-python needs
Nothing afterwards invalidated certifi 2020.12.5, so the resolver runs to the end… and proceeds to pick the wrong version of certifi!? (line 384)
So this is probably a bug in the resolver when it collects the final results. Still need to investigate more. Unfortunately(?) |
AHA. Apologies for my confusion here!
Yea, the resolver is marking the wrong requirement against the
From line 245:
From line 249:
That's... suboptimal at best. :/ |
I dug into for like two hours and finally think I know what’s going on. The trigger to this issue is that snowflake-connector-python specifies certifi twice. From the wheel’s metadata:
A wrikle to this is that there’s a reproducibility issue, because the issue only happen when dm[None].extend(reqs_for_extra(None)) so the order of requirements don’t change between runs. Now onto the actual resolver stuff. When the resolver pins through a candidate, it converts all of the candidate’s dependencies into criteria so they can be merged into existing criteria: pip/src/pip/_vendor/resolvelib/resolvers.py Lines 200 to 205 in 7c3abcc
But it uses a dict for the job. So when a candidate specifies a package multiple times (like snowflake-connector-python), the latter specification would override the previous one. Since I have to say, I haven’t had such an exercise debugging an issue like this for quite a while. This kind of things is why I’m doing open source work, so thanks for that, in a way 😆 I’m unfortunately quite busy tomorrow (it’s late Saturday here), but will try to find some time to fix asap. |
I posted #10083 which should fix this issue. It would be awesome if you could give it a try. |
@uranusjr yup seems to be working for me! Thanks for digging in - seems like it turned out to be quite the bug :) |
Awesome! I’ll merge the resolvelib fix, and will cut 0.7.1 when we release the next pip version for inclusion. |
Description
See reproduce steps for setup.
It installed
certifi==2021.5.30
, and then reported an error for a version mismatch. Instead, pip should have looked at the requirements and installed2020.12.5
to work with all the other dependencies.It seems that passing
--upgrade
makes it work.Ref: datahub-project/datahub#2717
Expected behavior
It should have installed
certifi==2020.12.5
, since the main requirements arecertifi<2021.0.0
and greater than a version from 2017.pip version
21.1.2
Python version
3.8.6
OS
MacOS
How to Reproduce
The following steps:
Yields:
Output
Edited by @uranusjr: I put this into a Gist instead since the log is way too long to reasonably read and reference in comments.
https://gist.github.com/uranusjr/74ec344ce72f9c9cbe91b262bcd49dd5
Code of Conduct
The text was updated successfully, but these errors were encountered: