Skip to content

Workspace virtual environment interpreter cannot be used for files outside workspace #1099

@rabyj

Description

@rabyj

Version

Extension: 1.16.0

vscode:

Version: 1.108.0
Commit: 94e8ae2b28cb5cc932b86e1070569c4463565c37
Date: 2026-01-08T13:53:10.781Z
Electron: 39.2.7
ElectronBuildId: 12953945
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Linux x64 6.14.0-37-generic (Ubuntu 24.04)

Description

When opening a Python file outside of the current workspace folder, VS Code assigns it the system/default Python interpreter, even though a workspace-specific virtual environment is already selected and remains correctly applied to all files within the workspace. The workspace interpreter cannot be selected for the external file due to a conflicting state message.

Uninstalling the python extension fixed the problem.

Steps to Reproduce

  1. Open VS Code with a workspace folder.
  2. Select a workspace-specific Python virtual environment.
  3. Verify that Python files inside the workspace use the selected interpreter.
Image
  1. Open a Python file located outside the workspace folder tree.
  2. Observe that the external file is assigned the system/default Python interpreter.
Image
  1. Attempt to select the workspace virtual environment for the external file.
Image

Actual Behavior

  • Python files inside the workspace continue to use the correct interpreter.
  • The Python file outside the workspace uses the system/default interpreter.
  • Attempting to select the workspace virtual environment for the external file results in the message:
"<workspace-venv> (<python version>)" is already selected as the environment for: "<workspace>"
  • As a result, the external file cannot be associated with the workspace virtual environment, even though it is not currently using it.

Expected Behavior

External Python files should be able to explicitly use the active workspace interpreter.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions