Skip to content

User scoped python.defaultInterpreterPath is constantly overwritten #25629

Open

Description

@ajstair

Type: Bug

Behaviour

When attempting to set:
"python.defaultInterpreterPath": "${workspaceFolder}/backend/.venv/bin/python3"
in the user scope settings, reloading the extension causes replacement of that variable with:
"python.defaultInterpreterPath": "/usr/bin/python3",

Note: I see the file update live around when the last two lines in the Python log display:

[info] Starting Pylance language server.
[info] Discover tests for workspace name: undefined - uri: /Users/username/Library/Application Support/Code/User/settings.json

There are also some errors in the logs below.

Steps to reproduce:

  1. Set "python.defaultInterpreterPath": "${workspaceFolder}/backend/.venv/bin/python3" in user settings.json
  2. Reload window/quit
  3. New value is "python.defaultInterpreterPath": "/usr/bin/python3"

Diagnostic data

Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

2025-12-04 16:20:11.529 [info] Telemetry level is off
2025-12-04 16:20:11.529 [info] Experiments are disabled, only manually opted experiments are active.
2025-12-04 16:20:11.793 [info] > pyenv which python
2025-12-04 16:20:11.793 [info] cwd: .
2025-12-04 16:20:11.835 [info] > conda info --json
2025-12-04 16:20:11.837 [info] > ~/.anaconda/bin/conda info --json
2025-12-04 16:20:11.888 [info] Active interpreter [/Users/username/dev/workspace-name]:  /usr/bin/python3
2025-12-04 16:20:11.971 [info] Active interpreter [/Users/username/dev/workspace-name]:  /Users/username/dev/workspace-name/backend/.venv/bin/python
2025-12-04 16:20:11.972 [info] Discover tests for workspace name: workspace-name - uri: /Users/username/dev/workspace-name
2025-12-04 16:20:11.980 [info] > . ./backend/.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2025.18.0-darwin-arm64/python_files/printEnvVariables.py
2025-12-04 16:20:11.980 [info] shell: bash
2025-12-04 16:20:11.981 [info] > . ./backend/.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2025.18.0-darwin-arm64/python_files/printEnvVariables.py
2025-12-04 16:20:11.981 [info] shell: bash
2025-12-04 16:20:11.986 [error] getActivatedEnvironmentVariables Error: Command failed: . /Users/username/dev/workspace-name/backend/.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /Users/username/.vscode/extensions/ms-python.python-2025.18.0-darwin-arm64/python_files/printEnvVariables.py
bash: line 1: 55171 Killed: 9               python /Users/username/.vscode/extensions/ms-python.python-2025.18.0-darwin-arm64/python_files/printEnvVariables.py

    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at ChildProcess.exithandler (node:child_process:418:12)
    at ChildProcess.emit (node:events:531:35)
    at maybeClose (node:internal/child_process:1101:16)
    at Socket.<anonymous> (node:internal/child_process:456:11)
    at Socket.emit (node:events:519:28)
    at Pipe.<anonymous> (node:net:346:12) {
  code: 137,
  killed: false,
  signal: null,
  cmd: ". /Users/username/dev/workspace-name/backend/.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /Users/username/.vscode/extensions/ms-python.python-2025.18.0-darwin-arm64/python_files/printEnvVariables.py"
}
2025-12-04 16:20:11.989 [error] getActivatedEnvironmentVariables Error: Command failed: . /Users/username/dev/workspace-name/backend/.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /Users/username/.vscode/extensions/ms-python.python-2025.18.0-darwin-arm64/python_files/printEnvVariables.py
bash: line 1: 55172 Killed: 9               python /Users/username/.vscode/extensions/ms-python.python-2025.18.0-darwin-arm64/python_files/printEnvVariables.py

    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at ChildProcess.exithandler (node:child_process:418:12)
    at ChildProcess.emit (node:events:531:35)
    at maybeClose (node:internal/child_process:1101:16)
    at Socket.<anonymous> (node:internal/child_process:456:11)
    at Socket.emit (node:events:519:28)
    at Pipe.<anonymous> (node:net:346:12) {
  code: 137,
  killed: false,
  signal: null,
  cmd: ". /Users/username/dev/workspace-name/backend/.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /Users/username/.vscode/extensions/ms-python.python-2025.18.0-darwin-arm64/python_files/printEnvVariables.py"
}
2025-12-04 16:20:22.426 [info] Starting Pylance language server.
2025-12-04 16:20:22.703 [info] Discover tests for workspace name: undefined - uri: /Users/username/Library/Application Support/Code/User/settings.json

Extension version: 2025.18.0
VS Code version: Code 1.106.3 (Universal) (bf9252a2fb45be6893dd8870c0bf37e2e1766d61, 2025-11-25T22:28:18.024Z)
OS version: Darwin arm64 24.4.0
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.6.final.0
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): System
  • Value of the python.languageServer setting: Pylance
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
Bookmarks ale 13.5.0
chatgpt ope 0.4.49
claude-code Ant 2.0.58
code-runner for 0.12.2
continue Con 1.2.11
copilot Git 1.388.0
copilot-chat Git 0.33.4
datawrangler ms- 1.24.0
debugpy ms- 2025.16.0
gitlens eam 17.7.1
js-debug ms- 1.105.0
js-debug-companion ms- 1.1.3
jupyter ms- 2025.9.1
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.3.0
live-server ms- 0.4.16
pylint ms- 2025.2.0
python ms- 2025.18.0
rainbow-csv mec 3.23.0
remote-containers ms- 0.431.1
remote-explorer ms- 0.5.0
remote-server ms- 1.5.3
remote-ssh ms- 0.120.0
remote-ssh-edit ms- 0.87.0
remote-wsl ms- 0.104.3
sql-developer Ora 25.3.2
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
vscode-pylance ms- 2025.10.3
vscode-python-envs ms- 1.12.0
vscode-remote-extensionpack ms- 0.26.0
vscode-tailwindcss bra 0.14.29
vscode-yaml red 1.19.1
System Info
Item Value
CPUs Apple M3 Max (16 x 2400)
GPU Status 2d_canvas: enabled
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 4, 4, 4
Memory (System) 64.00GB (1.45GB free)
Process Argv
Screen Reader no
VM 0%

Activity

  1. ajstair commented on Dec 9, 2025

    @ajstair
    Author

    I think I found the root cause. The python executable was somehow corrupted; the extension silently was falling back to the global python installation. The status bar interpreter version stayed on the corrupted version (3.11.5) but VSCode effectively started using the global installation (3.9). I confirmed that the executable (which was managed by UV) was corrupted by attempting to call it manually.

    This was a nightmare to debug - nowhere in the vscode or extension logs could I find an indication that the python executable was problematic. The interpreter selection status was misleading as well, making it seem like interpreter selection was successful (while silently using another version under the hood!). The python environment management plugin also was displaying inconsistent information in this case.

    I would recommend any of:
    a) displaying an error notification to the user if the python interpreter selection fails, rather than it silently falling back to global
    b) adding python/python environment extension logging for issues with the selected python executable

  2. added
    bugIssue identified by VS Code Team member as probable bug
    area-environmentsFeatures relating to handling interpreter environments
    confirmation pendingThe issue needs to be confirmed through a maintainer reproducing the bug.
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Dec 11, 2025
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 environmentsbugIssue identified by VS Code Team member as probable bugconfirmation pendingThe issue needs to be confirmed through a maintainer reproducing the bug.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions