Skip to content

getPythonEnvironmentInfo tool fails for venv created with uv #25463

Open

Description

The error is:

Error: Module 'pip' not installed.

It would be nice to support uv pip as a fallback for that case, if possible.

Activity

  1. moneytoyoung commented on Sep 14, 2025

    @moneytoyoung

    Have you override the codes .to your own codes just a question. Sometimes it is ok to use older codes and alter them!!.to the point

  2. eleanorjboyd commented on Sep 16, 2025

    @eleanorjboyd
    Member

    hm it should use uv pip for install - let me investigate. Thanks!

  3. eleanorjboyd commented on Sep 16, 2025

    @eleanorjboyd
    Member

    If you have uv installed it should be print into the logs something like this: Running: uv pip list --python /Users/eleanorboyd/vscode-python/.venv-2/bin/python.

    Can you check in your logs (for the python environment extension) and see if you see if you see it attempting a different command instead? Seems like it might not be recognizing that you have uv installed.

  4. moneytoyoung commented on Sep 16, 2025

    @moneytoyoung
  5. Gallaecio commented on Sep 18, 2025

    @Gallaecio
    Author

    I have just tested creating an empty folder, running uv venv inside, and then asking the chat to run getPythonEnvironmentInfo for .venv.

    Input:

    {
      "resourcePath": "/home/adrian/temporal/uv-test/.venv"
    }

    Output:

    Following is the information about the Python environment:
    1. Environment Type: unknown
    2. Version: 3.13.5.final.0
    
    3. Command Prefix to run Python in a terminal is: `/bin/python`
    Instead of running `Python sample.py` in the terminal, you will now run: `/bin/python sample.py`
    Similarly instead of running `Python -c "import sys;...."` in the terminal, you will now run: `/bin/python -c "import sys;...."`
    4. Below is a list of the Python packages, each in the format <name> or <name> (<version>). The version may be omitted if unknown: 
    - annotated-types (0.7.0)
    …
    - zstandard (0.25.0)

    Which is not what I reported. But something seems off nonetheless, the Python path is wrong.

    When I then ask for a package to be installed into .venv, even if I insist to target .venv, it seems to target a global installation path or something in the tool call title (it does mention .venv). The parameters do seem correct:

    {
      "packageList": [
        "scrapy"
      ],
      "resourcePath": "/home/adrian/temporal/uv-test/.venv"
    }

    Output:

    Successfully installed package: scrapy
    

    Yet:

    $ .venv/bin/python -c "import scrapy"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'scrapy'
    

    This does seem like a different issue from the one I reported originally, though. Shall I close this ticket and open a separate one?

  6. eleanorjboyd commented on Dec 12, 2025

    @eleanorjboyd
    Member

    Hi! Can you retry this now- we added a setting alwaysUseUv which defaults to true and should help but I am not sure for this specific scenario

  7. Gallaecio commented on Dec 15, 2025

    @Gallaecio
    Author

    With 2025.20.0, if I first create a venv with uv venv and then ask the chat to run this tool, I get:

    Error: Module 'pip' not installed.
    

    Which is, funny enough, the original issue, which I could not reproduce the last time.

    I did confirm that alwaysUseUv is in settings and is enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions