-
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 install does not seem to evaluate environment markers correctly per PEP 508 #12736
Comments
Can you test on an older pip version? I suspect this is a side effect of |
Hmm, seems unlikely given that pip 24.0 vendors packaging 21.3 and |
Oh, I thought 24.0 already upgrades packaging; I guess that’s 24.1 instead. |
This issue appears to happen on other Linuxes too. On Ubuntu boxes I can't use the This could be remediable if pip's marker evaluation used short-circuit boolean behavior. To illustrate, the following example fails with pip 24.1 on Ubuntu, even though there is no need to evaluate the remaining markers because the system isn't a macOS/Darwin system.
Output on a particular Ubuntu box:
|
Hello. Thanks for the detailed report! You are indeed correct that pip is violating the specification here. However, marker evaluation is implemented by pypa/packaging. During the time between your original report and now, I've filed pypa/packaging#816 to get packaging in compliance with the spec. |
Description
Note: Originally reported as an issue on uv, but upon closer consideration the behavior of
uv pip install
seems to be correct, and it ispip
that looks bugged.PEP 508 has this to say about environment markers:
Expected behavior
When an environment marker has a version comparison with a value that is not a valid PEP 440 version, the marker evaluation should fall back to the Python operation i.e. lexicographic string comparisons.
pip install
does not seem to do the "fall back to the Python behaviour" part.pip version
24.0
Python version
3.12.3
OS
Linux
How to Reproduce
I use
python:3.12.3-alpine
image as an example because it hasplatform.release()
value of "5.10.104-linuxkit" which can not be parsed as a PEP 440 version.In this context, the dependency
six==1.16.0
should have been selected and installed.Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: