Closed birkin closed 51 minutes ago
Is your Python located in the path specified by the PATH environment variable or the UV_PYTHON_INSTALL_DIR environment variable? https://docs.astral.sh/uv/concepts/python-versions/#discovery-of-python-versions
What is your uv version? And what is the result of uv python list
?
@FishAlchemist
no success yet...
Info:
uv 0.5.3
.PATH
environmental-variable./opt/local/python3.8.10/bin/python3
.UV_PYTHON_INSTALL_DIR
environmental-variable set.UV_PYTHON_INSTALL_DIR
envar (see below), running uv python list
yields:
cpython-3.13.0+freethreaded-linux-x86_64-gnu <download available>
cpython-3.12.7-linux-x86_64-gnu <download available>
cpython-3.11.10-linux-x86_64-gnu <download available>
cpython-3.10.15-linux-x86_64-gnu <download available>
cpython-3.9.20-linux-x86_64-gnu <download available>
cpython-3.8.20-linux-x86_64-gnu <download available>
cpython-3.7.9-linux-x86_64-gnu <download available>
pypy-3.10.14-linux-x86_64-gnu <download available>
pypy-3.9.19-linux-x86_64-gnu <download available>
pypy-3.8.16-linux-x86_64-gnu <download available>
pypy-3.7.13-linux-x86_64-gnu <download available>
Recently tried:
export UV_PYTHON_INSTALL_DIR="/opt/local/python3.8.10/bin"
. env | sort
.uv venv ./venv_2024-11-20 --python 3.8 --native-tls --python-preference only-system
command and got the same × No interpreter found for Python 3.8 in search path
message.UV_PYTHON_INSTALL_DIR
envar to a variety of other sub-directories of /opt/local/python3.8.10/
; all yielded the same × No interpreter found for Python 3.8 in search path
message.Thanks for your response, though; willing to try other things!
@birkin If there is no need to specify the installation path for the hosted Python, there is no need to specify UV_PYTHON_INSTALL_DIR. UV_PYTHON_INSTALL_DIR: Specifies the directory for storing managed Python installations.
However, if UV cannot find Python in the PATH and you don't plan to add this Python to the PATH, then specify the direct path to the Python interpreter.
--python /opt/local/python3.8.10/bin/
-p, --python <PYTHON> The Python interpreter to use for the virtual environment. [env: UV_PYTHON=]
@FishAlchemist -- Thanks; passing that path works! That must be in the documentation, but I'd missed it, so much appreciated. I'll close this issue.
For reference, this works:
uv venv ./venv_2024-11-20 --python "/opt/local/python3.8.10/bin/python3" --native-tls --python-preference only-system
I'm thinking I probably don't need the --native tls
. I had added that when I thought I'd possibly use a uv-installed version of python, and I'd heard that doing so might embed some open-ssh-stuff within the uv-compiled version of python (which is good) -- but then central-IT updates to any open-ssh security-vulnerabilities wouldn't be used by that uv-installed version of python. I may have mis-understood something; regardless, the flag shouldn't hurt anything if I'm pointing to a local version of python.
Similarly, I'm thinking the --python-preference only-system
isn't necessary if I'm pointing to a local version of python, but again, shouldn't cause any problem.
Just to clarify, UV_PYTHON_INSTALL_DIR
is where we install Python distributions to — we won't discover interpreters we do not manage in that directory.
It sounds like /opt/local/python3.8.10/bin/
isn't on your PATH
. Specifying it manually is totally reasonable too though.
It's documented at https://docs.astral.sh/uv/concepts/python-versions/#requesting-a-version
I'm trying to run the command:
uv venv ./venv_2024-11-20 --python 3.8 --native-tls --python-preference only-system
...to ensure I'm using a version of python already installed by our sys-admin. This yields the message:
× No interpreter found for Python 3.8 in search path
The system-version of python 3.8 I'm trying to install does exist an an /opt/local/... path. How can I pass its path to
uv venv ...
or otherwise makeuv venv ...
recognize this system-installed version?