Skip to content

Hatch fails to locate Python 3.10 when requires-python includes patch version #1950

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

Open
artyom-morozov opened this issue Apr 1, 2025 · 0 comments

Comments

@artyom-morozov
Copy link

Description

Hatch fails to create environments for Python 3.10 when the requires-python version in pyproject.toml includes a patch number (e.g., >=3.10.16). This issue occurs specifically with Python 3.10 in CI pipelines, even though Hatch successfully installs the Python version.

Environment

  • Ubuntu Runner: 24.04.2
  • Affected Python Version: 3.10
  • Working Python Version: 3.13

when we have the following in pyproject.toml

[project]
requires-python = ">=3.10.16"
...
[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.10", "3.13"]

When we have a github action workflow like this:

...
- name: Install Hatch
  uses: pypa/hatch@install

- name: Install Hatch Python
  shell: bash
  run: |
    hatch python install 3.10 3.13

- name: Setup env
  shell: bash
  run: |
      hatch env create hatch-test.py3.10

Behaviour

Hatch successfully installs Python versions:

Installing 3.10
Installed 3.10 @ /home/runner/work/*/*/.hatch_data/pythons/3.10
Installing 3.13
Installed 3.13 @ /home/runner/work/*/*/.hatch_data/pythons/3.13

But environment creation fails with error:

Environment `hatch-test.py3.10` is incompatible: cannot locate Python: 3.10
Error: Process completed with exit code 1.

Notes

  • Setting HATCH_PYTHON_SOURCE_PYPY3_10 environment variable does not resolve the issue
  • The issue only affects Python 3.10 when patch version is specified
  • Workaround: Remove patch version from requires-python (use >=3.10 instead of >=3.10.16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant