astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
26.37k stars 767 forks source link

error: No interpreter found -- #9088

Open EdmundsEcho opened 2 days ago

EdmundsEcho commented 2 days ago

I am new to uv.

The problem

When I tried to initialize a new project, I received the following:

❯ uv init TestProject --verbose
DEBUG uv 0.5.1 (f399a5271 2024-11-08)
DEBUG Reading Python requests from version file at `/Users/edmund/Downloads/.python-version`
DEBUG Searching for Python interpreter with executable name `3.10-dev`
DEBUG Checking for Python interpreter at executable name `3.10-dev`
error: No interpreter found for executable name `3.10-dev` in virtual environments, managed installations, or search path

The fix

Removed the .python-version present in the root folder from where I was trying to create the new project.

Longer term fix

I'm not sure if there is a better way to report the error, or dare I say use the version of python that I installed using uv. I don't know enough to have a POV.

Kanerix commented 2 days ago

I think your issue is that uv is reading the python version from a .python-version file in your downloads folder.

That version is not valid (use uv python list --all-versions to see valid versions if im not mistaken).

This line shows your issue:

DEBUG Reading Python requests from version file at `/Users/edmund/Downloads/.python-version`
charliermarsh commented 2 days ago

Thanks for filing. @Kanerix is right that we're reading 3.10-dev from your .python-version file. Then, because it's not a valid version, we assume it's the name of an executable, and we can't find an executable named 3.10-dev. Agree it would be nice if the error message included more context here.