-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Bad error message when python query encounters python 2 #1693
Comments
For Python2.7 this is to be expected, as What does |
@sbrugman I did not install the tool for python 3.10, so currently it raises following. I installed it globally with the powershell script mentioned in the pypi docs |
@sbrugman So I installed uv for python 3.10 and tried to create venv as you mentioned. The error is the same. It is taking Python 2 path into consideration. |
Sorry you're experiencing this. I'm currently looking into improving the python discovery on Windows see #1310. I hope that this will fix your issue too. |
Thanks @MichaReiser for the quick response |
@MichaReiser I created #1698 just as observation. It is possibly a side effect of the issue you are working on already but reported just in case it can help to improve the solution. thanks |
@fervand1 can you give it a try once #1711 is released? I suspect that this might solve your problem because it changes the precedence to first query The question that remains is if we should be more lenient when it comes to failures querying the python information and instead continue searching for other "functioning" installation. @konstin what do you think? |
We don't support python 2; We should check for python major != 3 and raise an error in the script we pass to python |
We should special case python 2 (e.g. returns a specific json message), but otherwise it think we should at least for now show errors. If we encounter many unrelated errors, we can be more lenient later |
@MichaReiser I installed new version of uv via irm and it seems to be resolved. Also I noticed we can pass |
## Summary Fixes #1693 `uv` currently fails when a user has `python` 2 or older installed on their system without a `python3` or `python3.exe` on their path because the `get_interpreter_info.py` script fails executing (it uses some Python 3+ APIs). This PR fixes this by: * Returning an explicit error code in `get_interpreter_info` if the Python version isn't supported * Skipping over this error in `python_query` if the user requested ANY python version or a version >= 3. * Error if the user requested a Python 2 version. ## Test Plan Error if the user requests a legacy python version. ``` uv venv -p 2 × Python 2 or older is not supported. Please use Python 3 or newer. ``` Ignore any python 2 installation when querying newer python installations (using v4 here because I have python3 on the path and that takes precedence over querying python) ``` uv_interpreter::python_query::find_python selector=Major(4) 0.005541s 0ms DEBUG uv_interpreter::interpreter Detecting markers for: /home/micha/.pyenv/shims/python 0.059730s 54ms DEBUG uv_interpreter::python_query Found a Python 2 installation that isn't supported by uv, skipping. 0.059983s 54ms DEBUG uv_interpreter::interpreter Using cached markers for: /usr/bin/python × No Python 4 In `PATH`. Is Python 4 installed? ```
Steps to reproduce:
Install uv using command - irm https://astral.sh/uv/install.ps1 | iex
Run command - uv venv. You will see error shown in the screenshot

The current uv platform - windows 10
uv version - 0.1.5
Note: In the windows path I only have path related to python 2. I also have python 3.10 and 3.12 installed but they can be ran using "py" command and are not added to the path. So something like
py -3.10 -m venv venv
creates python 3.10 envSince 'py' command is accepted norm on windows , I would expect the tool to run with the same and not consider python 2.7 path as a default python path.
Also preferably during install it should prompt what python version he would expect to run uv from maybe?
The text was updated successfully, but these errors were encountered: