If I configure a project with requires_python '>=3.12', on my system I see this error:
|
else 'no compatible Python distribution available' |
I don’t understand what the code is supposed to do. It requires either an env variable or one of two functions to not return None:
-
_get_available_distribution seems to call hatch.python.resolve.get_compatible_distributions, and then it removes the “installed distribution”
|
compatible_distributions = get_compatible_distributions() |
|
for installed_distribution in self.python_manager.get_installed(): |
|
compatible_distributions.pop(installed_distribution, None) |
get_compatible_distributions() returns everything hatch can download:
$ ~/.local/pipx/venvs/hatch/bin/python -c '
❯ from hatch.python.resolve import get_compatible_distributions
❯ print(get_compatible_distributions().keys())'
dict_keys(['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy2.7', 'pypy3.9', 'pypy3.10'])
In my case self.python_manager.get_installed().keys() == {'3.12'}, so _get_available_distribution returns None
-
_find_existing_interpreter calls virtualenv.discovery.builtin.propose_interpreters, which yields this on my system:
PythonInfo(spec=CPython3.11.8.final.0-64, system=/usr/bin/python3.11, exe=/home/phil/.local/pipx/venvs/hatch/bin/python, platform=linux, version='3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801]', encoding_fs_io=utf-8-utf-8)
PathPythonInfo(spec=CPython3.11.8.final.0-64, exe=/usr/bin/python, platform=linux, version='3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801]', encoding_fs_io=utf-8-utf-8)
so that function also returns None.
I can work around this using
pipx install --python=python3.12 hatch
but this should still be fixed. I’d be happy to help, but I don’t know what the intended semantics of _get_available_distribution and _find_existing_interpreter are: Which one of these is supposed to return /usr/bin/python3.12?
If I configure a project with
requires_python '>=3.12', on my system I see this error:hatch/src/hatch/env/virtual.py
Line 258 in 8648544
I don’t understand what the code is supposed to do. It requires either an env variable or one of two functions to not return
None:_get_available_distributionseems to callhatch.python.resolve.get_compatible_distributions, and then it removes the “installed distribution”hatch/src/hatch/env/virtual.py
Lines 374 to 376 in 8648544
get_compatible_distributions()returns everything hatch can download:In my case
self.python_manager.get_installed().keys() == {'3.12'}, so_get_available_distributionreturnsNone_find_existing_interpretercallsvirtualenv.discovery.builtin.propose_interpreters, which yields this on my system:so that function also returns
None.I can work around this using
but this should still be fixed. I’d be happy to help, but I don’t know what the intended semantics of
_get_available_distributionand_find_existing_interpreterare: Which one of these is supposed to return/usr/bin/python3.12?