Skip to content

Requires-Python seems to ignore --python-version #12216

Closed
@thejcannon

Description

@thejcannon

Description

Using Python 3.11 with pip, and trying to --report on a wheel for Python 3.9, where the wheel has a Requires-Python >=3.7,<3.10 I'm seeing:

ERROR: Packages require a different Python. 3.11.4 not in:
'<3.10,>=3.7' (required by pantsbuild-pants 2.16.1rc0 (from https://files.pythonhosted.org/packages/6f/0d/39d08770aece1f32d2f26286b45a9d91ece24db58b3e202bcb032ecc63d6/pantsbuild.pants-2.16.1rc0-cp39-cp39-manylinux2014_x86_64.whl (from https://pypi.org/simple/pantsbuild-pants/) (requires-python:>=3.7,<3.10)))

My workaround is to use --ignore-requires-python (eww)

Expected behavior

The "installation" goes on as expected since --python-version is 3.9 😄

pip version

23.2.1

Python version

3.11.4

OS

Ubuntu

How to Reproduce

  1. Have Python 3.11 lying around
  2. python3.11 -m pip install --ignore-installed --dry-run --report report.txt --python-version 3.9 --only-binary :all: --target . pantsbuild.pants==2.16.0 (note --target is only required due to --target required for --python-version even though using --ignore-installed --dry-run #12215
  3. 😭

Output

No response

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    S: needs triageIssues/PRs that need to be triagedtype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions