Skip to content

Incorrectly loads uv interpreters #667

Closed

Description

Given the issues with this extensions, I'd highly recommend disabling / not installing this by default.

Repo:

  1. Install uv as your Python package manager
  2. Open a monorepo with uv syncd subdirectory
  3. See available VS Code environments from "Select a Python Environment"

Expected: Able to locate Python environment automatically
Actual: Unable to locate uv Python environment

  1. As workaround to above, I tried to enter my interpreter path directly in "Select a Python Environment"

Expected: Able to paste interpreter path into "Select a Python Environment" just like it works with this extension disabled/uninstalled
Actual: Pasting paths doesn't work. Have to manually navigate through GUI to the correct path

  1. Select appropriate uv python binary location

Expected: VS Code loads appropriate uv environment (eg ./backend/.venv/bin/python)
Actual: VS Code now follows symlink and loads incorrect uv share environment path (eg /Users/justin/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/bin/python) and thus unable to locate necessary packages to run anything

Workaround:
Disable (or uninstall) Python Environments avoids all issues above:

  • Seems to find the uv interpreter automatically from appropriate subdirectory
  • Able if desired to copy/paste uv environment location directly into "Enter interpreter path..." (no need for manually navigate paths in GUI)
  • Environment works and able to run

Activity

  1. justinerickson commented on Jul 29, 2025

    @justinerickson
    Author

    Seems to load uv venv fine in a simpler project setup with uv environment in the root directory using a different version of Python in the environment. Possibly one or more of the following is causing this:

    • Extension is unable to handle monorepos where Python uv environments are in sudirectories
    • Extension is unable to handle manually supplied uv environments in general (per repro step 4)
    • Extension is unable to deal with Python uv environments where the underlying Python version is shared by uv (eg it's incorrectly trying to resolve symlinks when it shouldn't)
  2. eleanorjboyd commented on Jul 30, 2025

    @eleanorjboyd
    Contributor

    Thank you for the detailed report- will investigate!

  3. eleanorjboyd commented on Aug 22, 2025

    @eleanorjboyd
    Contributor

    Hello! Taking a closer look at this- could you try running Python: Run Python Environment Tool (PET) in Terminal...
    from the command palette. Then select "resolve" and paste in ./backend/.venv/bin/python or the absolute path equivilent and let me know what it returns. Starting to work on this and need to make sure I know what it is resolving to with our PET tool. I think it will be the same as this problem: #541 but would appreciate the extra context as I investigate.

    Per your other questions, I am making some changes to how workspace environments are discovered. For now you can right click on the parent folder of the .venv you are trying to get the extension to recognize and select "add as python project" this should make the venv findable after a window reload. Thanks!

    Image
  4. justinerickson commented on Aug 22, 2025

    @justinerickson
    Author

    I'm unblocked by disabling the extension (it is too problematic without utility for my needs). Below is the requested info with the extension temporarily enabled with a few minor redacted changes:

    • String replaced my expanded home directory with "~"
    • String replaced my project name with "REDACTED_PROJECT_NAME"
    "~/.vscode/extensions/ms-python.vscode-python-envs-1.2.0-darwin-arm64/python-env-tools/bin/pet"
    source ~/git/REDACTED_PROJECT_NAME/backend/.venv/bin/activate
    ➜  REDACTED_PROJECT_NAME "~/.vscode/extensions/ms-python.vscode-python-envs-1.2.0-darwin-arm64/python-env-tools/bin/pet"
    Environment (GlobalPaths)
       Executable  : ~/.local/bin/python3.12
       Version     : 3.12.6.final.0
       Prefix      : ~/.local/share/uv/python/cpython-3.12.6-macos-aarch64-none
       Architecture: x64
       Symlinks    : "~/.local/bin/python3.12"
    
    Environment (MacCommandLineTools)
       Executable  : /usr/bin/python3
       Version     : 3.9.6.final.0
       Prefix      : /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9
       Architecture: x64
       Symlinks    : "/usr/bin/python3"
                   : "/Library/Developer/CommandLineTools/usr/bin/python3"
                   : "/Library/Developer/CommandLineTools/usr/bin/python3.9"
                   : "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3"
                   : "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9"
    
    
    Breakdown by each locator:
    --------------------------
    Conda                : 6.56275ms
    Homebrew             : 18.926625ms
    MacCommandLineTools  : 32.863916ms
    MacPythonOrg         : 5.042µs
    MacXCode             : 225.792µs
    PipEnv               : 0ns
    Pixi                 : 208ns
    Poetry               : 212.834µs
    PyEnv                : 68.75µs
    Venv                 : 59.458µs
    VirtualEnv           : 58.542µs
    VirtualEnvWrapper    : 177.917µs
    
    Breakdown for finding Environments:
    -----------------------------------
    GlobalVirtualEnvs    : 36.083µs
    Locators             : 33.308958ms
    Path                 : 34.585166ms
    Workspaces           : 1.574ms
    
    Environments (2):
    ------------------
    GlobalPaths          : 1
    MacCommandLineTools  : 1
    
    Completed in 69ms
    ➜  REDACTED_PROJECT_NAME source ~/git/REDACTED_PROJECT_NAME/backend/.venv/bin/activate
    
    
  5. github-actions commented on Sep 6, 2025

    @github-actions

    Hey Eleanor Boyd (@eleanorjboyd), this issue might need further attention.

    Justin Erickson (@justinerickson), you can help us out by closing this issue if the problem no longer exists, or adding more information.

  6. github-actions commented on Sep 20, 2025

    @github-actions

    Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.

    Happy Coding!

  7. justinerickson commented on Sep 20, 2025

    @justinerickson
    Author

    The requested info was provided a month ago in my last reply and this issue blocks use of this extension with uv. This project permissions blocks me from directly re-opening issues, so please re-open this issue.

  8. zsol commented on Oct 11, 2025

    @zsol
    Contributor

    Hey! I ran into this a while ago and made microsoft/python-environment-tools#263 to get PET to recognize uv workspaces which I thought would address item 3 from the OP, but that's not the case. I think the extension side needs to change too to get the discovered environments into the environment picker - so I started looking at making an extension that would implement EnvironmentManager but I'm not sure the extension API exposes NativePythonFinder (IIUC that's the typescript representation of PET).

    So I see three ways forward all with different tradeoffs:

    1. Get some basic support for uv workspaces and environments merged into PET & this extension
    2. Get basic support for uv workspaces and environments merged into PET, make access to the bundled PET available through this extension's API, and make a separate extension that would hook into these new APIs
    3. Don't change PET, ship a separate extension that reimplements the workspace/env finding/resolving logic separately (ideally within uv itself)

    Any advice/thoughts?

  9. eleanorjboyd commented on Dec 17, 2025

    @eleanorjboyd
    Contributor

    Zsolt Dollenstein (@zsol) had implemented basic discovery so uv environments are recognized as such! Would love people's feedback here and I plan to make documentation updates to help clarify uv for the extension

  10. eleanorjboyd commented on Jan 13, 2026

    @eleanorjboyd
    Contributor

    closing as the implementation is shipped from Zsolt Dollenstein (@zsol). Please open a new issue if you have bugs or feedback. Thanks

  11. locked as resolved and limited conversation to collaborators on Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions