Skip to content

VS Code cannot activate Python virtual environments outside the workspace #25649

Closed

Description

@hermitguo

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.106.3
  • OS Version: ubuntu budgie 24.04.03 + x11 + 6.14.0-35-generic

Steps to Reproduce:

  1. create .vscode
  2. settings launch.json
    { "version": "0.2.0", "configurations": [ { "name": "Python Debugger: Current File", "type": "debugpy", "python": "/opt/pyenv/erp19py3.13/bin/python3", "request": "launch", "program": "${file}", "console": "integratedTerminal" }, { "name": "ERP19Linux", "type": "debugpy", "python": "/opt/pyenv/erp19py3.13/bin/python3", "request": "launch", "program": "${workspaceFolder}/odoo-bin", "args": [ "-c", "${workspaceFolder}/odoo.conf", // "-u", // "estate", // "--dev=xml" ], "console": "integratedTerminal", "justMyCode": false, }, ] }
  3. settings launch.json
    { "cSpell.words": [ "odoo", "logfile" ], "terminal.integrated.profiles.linux": { "pyenv": { "path": "bash", "args": [ "-c", "source /opt/pyenv/erp19py3.13/bin/activate; exec bash -i" ] } }, "terminal.integrated.defaultProfile.linux": "pyenv", "python.terminal.activateEnvironment": false, "python.defaultInterpreterPath": "/opt/pyenv/erp19py3.13/bin/python" }
Image Image Image Image Image Image

####################### Expected result ################

  1. Opening VS Code should activate the corresponding virtual environment
  2. Ctrl+shit+p displays the corresponding virtual environment when manually entering a path

Activity

  1. anthonykim1 commented on Dec 11, 2025

    @anthonykim1

    I see pyenv not detected on your interpreter path. Maybe try environment extension to see if that picks it up.
    It will probably activate once extension discovers your venv.
    Try install https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-python-envs

    Can you update Python extension, Python environment extension to latest and see if you can still repro?
    Also add "python.useEnvironmentsExtension": true, to your settings.json.

    Please file issue on https://github.com/microsoft/vscode-python-environments/issues if you see problem again,

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

Metadata

Metadata

Labels

area-environmentsFeatures relating to handling interpreter environmentsarea-terminalinfo-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions