I use a local venv in python3.10 but compile requirements for python 3.8 (requirements used for dockerized apps) . I have both versions (along the default python 3.12) installed.
Even when I have no my 3.10 venv active uv reports the following
warning: The requested Python version 3.8 is not available. 3.10.14 will be used . But if I run python3.8 it works.
tin@morocha:~/lab/Project-API$ make dependencies
UV_CUSTOM_COMPILE_COMMAND="make dependencies" uv pip compile --python-version 3.8 --generate-hashes --output-file app/requirements/requirements-dev.txt app/requirements/requirements-dev.in
warning: The requested Python version 3.8 is not available; 3.10.14 will be used to build dependencies instead.
⠙ aiohttp==3.9.5 ^Cmake: *** [Makefile:17: app/requirements/requirements-dev.txt] Interrupción
tin@morocha:~/lab/Project-API$ python3.8
Python 3.8.19 (default, Apr 27 2024, 21:20:48)
[GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
tin@morocha:~/lab/Project-API$ which python3.8
/usr/bin/python3.8
tin@morocha:~/lab/Project-API$ python
Python 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
tin@morocha:~/lab/Project-API$ which python3.10
/usr/bin/python3.10
tin@morocha:~/lab/Project-API$ python3.10
Python 3.10.14 (main, Apr 27 2024, 21:17:55) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Debugging with --verbose I found the cause
DEBUG Starting interpreter discovery for Python 3.8
DEBUG Looking for exact match for request Python 3.8
DEBUG Searching for Python 3.8 in all sources
DEBUG Found CPython 3.10.14 at `/home/tin/lab/Project-API/.venv/bin/python3` (virtual environment)
DEBUG Querying Python at `/usr/bin/python3.8` failed with exit status exit status: 1
--- stdout:
--- stderr:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/tin/.cache/uv/.tmpy3nPfq/python/get_interpreter_info.py", line 555, in main
"scheme": get_scheme(),
File "/home/tin/.cache/uv/.tmpy3nPfq/python/get_interpreter_info.py", line 415, in get_scheme
return get_distutils_scheme()
File "/home/tin/.cache/uv/.tmpy3nPfq/python/get_interpreter_info.py", line 357, in get_distutils_scheme
from distutils.dist import Distribution
ModuleNotFoundError: No module named 'distutils.dist'
---
DEBUG Found CPython 3.12.3 at `/usr/bin/python3` (search path)
DEBUG Found CPython 3.12.3 at `/usr/bin/python` (search path)
DEBUG Querying Python at `/bin/python3.8` failed with exit status exit status: 1
--- stdout:
so after installing sudo apt install python3.8-distutils it works.
The error message could be clearer and indicate the exact issue, such as the missing distutils module, to help users resolve the problem more efficiently.
Thanks for the report. It should be relatively straight-forward to add a try/except with a better message in get_interpreter_info if someone is interested.
I use a local venv in python3.10 but compile requirements for python 3.8 (requirements used for dockerized apps) . I have both versions (along the default python 3.12) installed.
Even when I have no my 3.10 venv active uv reports the following
warning: The requested Python version 3.8 is not available. 3.10.14 will be used
. But if I runpython3.8
it works.Debugging with
--verbose
I found the causeso after installing
sudo apt install python3.8-distutils
it works.The error message could be clearer and indicate the exact issue, such as the missing distutils module, to help users resolve the problem more efficiently.