-
Notifications
You must be signed in to change notification settings - Fork 772
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
uv pip venv discovery broken for some relative paths #3784
Comments
Actually I just noticed this is broken even if I specify the venv path, i.e. |
Hi @bulletmark thanks for the details. Could you share logs with trace logs i.e. |
I can't reproduce this with a simple case
|
|
Actually, just noticed that the last example above (
I.e. it still seems to want to use that bogus |
Seems to me that uv is caching the name of |
Thanks for the details! I'll dig into this |
Hard to reproduce, but I think our CIs are broken for something similar: https://app.circleci.com/pipelines/github/huggingface/transformers/93822/workflows/50779f61-f59f-483d-bc3f-9b173dd4cc15/jobs/1231217 starting uv==0.2.2
|
Ah yeah, we stopped supporting the use of
Or point it to a specific Python:
|
I reproduced this and have a fix up at #3823 |
Closes #3784 The cache did not use an absolute path. I'm not sure this is actually a new bug, as this code wasn't touched in #3266 but perhaps there was a slight difference in the paths we were passing around. Note, just canonicalizing the path as soon as we see it doesn't work because then we jump out of the virtual environmnent into the system interpreter. ## Test plan ``` ❯ uv venv Using Python 3.12.3 interpreter at: /opt/homebrew/opt/python@3.12/bin/python3.12 Creating virtualenv at: .venv Activate with: source .venv/bin/activate ❯ uv pip install anyio Resolved 3 packages in 81ms Installed 3 packages in 4ms + anyio==4.3.0 + idna==3.7 + sniffio==1.3.1 ❯ mkdir uv-issue-3784 && cd uv-issue-3784 ❯ uv venv Using Python 3.12.3 interpreter at: /opt/homebrew/opt/python@3.12/bin/python3.12 Creating virtualenv at: .venv Activate with: source .venv/bin/activate ❯ gcm Switched to branch 'main' Your branch is up to date with 'origin/main'. ❯ cargo run -q -- pip list -v -p .venv DEBUG Checking for Python interpreter in directory `.venv` TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3 DEBUG Using Python 3.12.3 environment at .venv/bin/python3 Package Version ------- ------- anyio 4.3.0 idna 3.7 sniffio 1.3.1 ❯ cd uv-issue-3784 ❯ cargo run -q -- pip list -v -p .venv DEBUG Checking for Python interpreter in directory `.venv` TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3 DEBUG Using Python 3.12.3 environment at /Users/zb/workspace/uv/.venv/bin/python3 Package Version ------- ------- anyio 4.3.0 idna 3.7 sniffio 1.3.1 ❯ cd .. ❯ gco zb/fix-relative-venv Switched to branch 'zb/fix-relative-venv' ❯ cargo run -q -- pip list -v -p .venv DEBUG Checking for Python interpreter in directory `.venv` TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3 DEBUG Using Python 3.12.3 environment at .venv/bin/python3 Package Version ------- ------- anyio 4.3.0 idna 3.7 sniffio 1.3.1 ❯ cd uv-issue-3784 ❯ cargo run -q -- pip list -v -p .venv DEBUG Checking for Python interpreter in directory `.venv` TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3 DEBUG Using Python 3.12.3 environment at .venv/bin/python3 ```
Better to use the version symlinks directly given that `uv` has recently fixed venv creation so it now respects symlinks to python executables and does not resolve them, just as `python -m venv` does. See astral-sh/uv#3784.
I am using:
I create a venv and the let
uv pip
discover that at the default.venv/
:However, I tend to use
$VIRTUAL_ENV
to relatively specify my various venv paths and this is broken since 0.2.2 (probably since 0.2.0?):Note the "Found a .." which is correct and the next "Using .." which is bogus. I have no idea how it picked up that bogus venv.
If I set
export VIRTUAL_ENV=./.venv
or I set it to an absolute path it works.The text was updated successfully, but these errors were encountered: