Skip to content
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 show ignores environment markers #12165

Closed
1 task done
wimglenn opened this issue Jul 19, 2023 · 6 comments · Fixed by #12291
Closed
1 task done

pip show ignores environment markers #12165

wimglenn opened this issue Jul 19, 2023 · 6 comments · Fixed by #12291
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior

Comments

@wimglenn
Copy link
Contributor

wimglenn commented Jul 19, 2023

Description

Perhaps the best explanation is to offer an example:

$ pip show opencv-python | grep Requires
Requires: numpy, numpy, numpy, numpy, numpy, numpy

Wow, it really wants numpy! :)

The reason is that environment markers are there:
https://github.com/opencv/opencv-python/blob/43cd7169cb92d96898d59753796678495b95c833/setup.py#L26-L36

Expected behavior

I'm not sure whether they should be deduplicated by pip:

Requires: numpy

Evaluated and merged by pip (in my case for Python-3.11 on macOS):

Requires: numpy >=1.23.5

Or just rendered without evaluation. It's pretty crazy for this distribution (opencv-python==4.8.0.74) but I guess that would be something like:

Requires: numpy (>=1.13.3) ; python_version < "3.7", numpy (>=1.21.0) ; python_version <= "3.9" and platform_system == "Darwin" and platform_machine == "arm64", numpy (>=1.21.2) ; python_version >= "3.10", numpy (>=1.21.4) ; python_version >= "3.10" and platform_system == "Darwin", numpy (>=1.23.5) ; python_version >= "3.11", numpy (>=1.19.3) ; python_version >= "3.6" and platform_system == "Linux" and platform_machine == "aarch64", numpy (>=1.17.0) ; python_version >= "3.7", numpy (>=1.17.3) ; python_version >= "3.8", numpy (>=1.19.3) ; python_version >= "3.9"

The latter is probably my preference, even though this particular package makes it look pathological. The current behavior of stripping the markers entirely in pip show's output seems worse than any of these options.

pip version

23.2

Python version

3.11

OS

macOS

How to Reproduce

pip install opencv-python
pip show opencv-python

Output

No response

Code of Conduct

@wimglenn wimglenn added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Jul 19, 2023
@HanslettTheDev
Copy link

I have a similar issue when adding environment markers

@uranusjr
Copy link
Member

Pull requests are always welcomed.

@wimglenn
Copy link
Contributor Author

@uranusjr Well, which of the outputs mentioned in "Expected behavior" would you like to see in a PR?

@uranusjr
Copy link
Member

pip show is never strictly accurate and is bounded by the current platform so I’d say numpy is enough.

@chrysle
Copy link
Contributor

chrysle commented Sep 13, 2023

@wimglenn Do you want to tackle the issue? Otherwise I'd give it a try.

@wimglenn
Copy link
Contributor Author

@chrysle go ahead

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants