Environment data
- Python Environments extension version: 1.36.0
- Python extension version: 2026.4.0
- VS Code version: 1.130.0 (user)
- OS and version: Windows 11 Enterprise 25H2
- Python version: 3.14.6 (installed using Python Install Manager)
- Environment manager in use: uv 0.11.29
- Shell: pwsh
- Remote / container scenario: none
- Workspace type: singe folder
- Is this a regression? If yes, last known working extension version: unknown
Repro Steps
- Create an empty workspace
- Make sure that
python.useEnvironmentsExtension is true
- Create an virtual environment in it (e.g.
uv init; uv sync or python -mvenv .venv)
- Select the virtual environment as Python interpreter for the workspace (Ctrl-Shift-P => Python: Select interpreter)
- Add this .vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Test (args): OK",
"type": "shell",
"command": "${command:python.interpreterPath}",
"args": ["-c", "import sys; print(sys.executable)", "Dummy"],
"group": {"kind": "build"}
}, {
"label": "Test (args): ERROR (input)",
"type": "shell",
"command": "${command:python.interpreterPath}",
"args": ["-c", "import sys; print(sys.executable)", "${input:Dummy}"],
"group": {"kind": "build"}
}, {
"label": "Test (args): ERROR (env)",
"type": "shell",
"command": "${command:python.interpreterPath}",
"args": ["-c", "import sys; print(sys.executable)", "${env:DUMMY}"],
"group": {"kind": "build"}
}, {
"label": "Test (cmd): OK",
"type": "shell",
"command": "${command:python.interpreterPath} -c 'import sys; print(sys.executable)'",
"group": {"kind": "build"}
}, {
"label": "Test (cmd): ERROR (env)",
"type": "shell",
"command": "${command:python.interpreterPath} -c 'import sys; print(sys.executable)' '${env:DUMMY}'",
"group": {"kind": "build"}
}
],
"inputs": [
{
"id": "Dummy",
"type": "promptString",
"description": "Dummy string for demonstration",
"default": "Dummy"
}
]
}
- Run the different build tasks
Expected behaviour
All tasks should use (and output) Python binary from the virtual environment (e.g. D:\src\vscode-bug\.venv\Scripts\python.exe)
Actual behavior
All tasks (labelled … OK) without additional variables in the command or args run as expected using the Python interpreter from the .venv for ${command:python.interpreterPath}.
All tasks (labelled … ERROR) with additional variables in the command or args run using the GLOBAL Python interpreter for ${command:python.interpreterPath}.
Neither the user nor the workspace setting for python.defaultInterpreterPath are used.

Logs
Error case
Running task "Test (args): ERROR (env)"
Python Environments Trace
2026-07-24 16:34:47.720 [debug] Checking venv (ms-python.python:venv) for d:\src\vscode-bug\.venv\Scripts\python.exe
2026-07-24 16:34:47.721 [debug] Using venv (ms-python.python:venv) to handle d:\src\vscode-bug\.venv\Scripts\python.exe
2026-07-24 16:34:50.060 [debug] inlineScriptLazyDetector: event received (open) output:ms-python.vscode-python-envs.Python%20Environments.log
2026-07-24 16:34:50.060 [debug] inlineScriptLazyDetector: skipped (open) output:ms-python.vscode-python-envs.Python%20Environments.log (scheme='output', extname='.log', inWorkspace=false)
Python Trace
2026-07-24 16:34:47.800 [debug] Extension unknown accessed getActiveEnvironmentPath with args: undefined
2026-07-24 16:34:47.800 [debug] Extension unknown accessed resolveEnvironment with args: {"id":"D:\\SRC\\VSCODE-BUG\\.VENV\\SCRIPTS\\PYTHON.EXE","path":"d:\\src\\vscode-bug\\.venv\\Scripts\\python.exe"}
Task output
* Executing task: C:\Users\MyUserName\AppData\Local\Python\pythoncore-3.14-64\python.exe -c 'import sys; print(sys.executable)'
C:\Users\MyUserName\AppData\Local\Python\pythoncore-3.14-64\python.exe
* Terminal will be reused by tasks, press any key to close it.
Good case
Running task "Test (args): OK"
Python Environments Trace
2026-07-24 16:33:56.467 [debug] Checking venv (ms-python.python:venv) for d:\src\vscode-bug\.venv\Scripts\python.exe
2026-07-24 16:33:56.467 [debug] Using venv (ms-python.python:venv) to handle d:\src\vscode-bug\.venv\Scripts\python.exe
2026-07-24 16:33:58.000 [debug] inlineScriptLazyDetector: event received (open) output:ms-python.vscode-python-envs.Python%20Environments.log
2026-07-24 16:33:58.000 [debug] inlineScriptLazyDetector: skipped (open) output:ms-python.vscode-python-envs.Python%20Environments.log (scheme='output', extname='.log', inWorkspace=false)
Python Trace
2026-07-24 16:33:56.613 [debug] Extension unknown accessed getActiveEnvironmentPath with args: undefined
2026-07-24 16:33:56.613 [debug] Extension unknown accessed resolveEnvironment with args: {"id":"D:\\SRC\\VSCODE-BUG\\.VENV\\SCRIPTS\\PYTHON.EXE","path":"d:\\src\\vscode-bug\\.venv\\Scripts\\python.exe"}
Task output
* Executing task: d:\src\vscode-bug\.venv\Scripts\python.exe -c 'import sys; print(sys.executable)' Dummy
D:\src\vscode-bug\.venv\Scripts\python.exe
* Terminal will be reused by tasks, press any key to close it.
Additional context
Python Environments Trace during VS Code startup
2026-07-24 16:20:47.807 [info] Python-envs extension version: 1.36.0
2026-07-24 16:20:47.808 [info]
=== Python Envs Configuration Levels ===
2026-07-24 16:20:47.808 [info] {
"section": "Python Envs Configuration Levels",
"defaultEnvManager": {
"workspaceFolderValue": "undefined",
"workspaceValue": "undefined",
"globalValue": "undefined",
"defaultValue": "ms-python.python:venv"
},
"defaultPackageManager": {
"workspaceFolderValue": "undefined",
"workspaceValue": "undefined",
"globalValue": "undefined",
"defaultValue": "ms-python.python:pip"
}
}
2026-07-24 16:20:47.808 [info] [pet] Starting Python Locator c:\Users\MyUserName\.vscode\extensions\ms-python.vscode-python-envs-1.36.0-win32-x64\python-env-tools\bin\pet.exe server
2026-07-24 16:20:47.808 [info] Registering pyenv manager (environments will be discovered lazily)
2026-07-24 16:20:47.808 [info] Registering pipenv manager (environments will be discovered lazily)
2026-07-24 16:20:47.808 [info] Registering poetry manager (environments will be discovered lazily)
2026-07-24 16:20:47.808 [info] [pet] configure: Sending configuration update: {"workspaceDirectories":["d:\\src\\vscode-bug"],"environmentDirectories":["d:/src/vscode-bug/.venv","d:/src/vscode-bug/*/.venv"],"pipenvExecutable":"pipenv","poetryExecutable":"poetry","cacheDirectory":"c:\\Users\\MyUserName\\AppData\\Roaming\\Code\\User\\globalStorage\\ms-python.vscode-python-envs\\pythonLocator"}
2026-07-24 16:20:47.808 [info] Extension for manager ms-python.python:venv is not active: Activating...
2026-07-24 16:20:47.813 [error] [pet] �[2m 0.077059700s�[0m �[33m WARN�[0m �[2mpet_windows_registry::environments�[0m�[2m:�[0m Failed to open HKLM\Software\Python, Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }
2026-07-24 16:20:47.816 [info] Discovered env: C:\Users\MyUserName\AppData\Local\Python\pythoncore-3.13-64\python.exe
2026-07-24 16:20:47.816 [info] Discovered env: C:\Users\MyUserName\AppData\Local\Python\pythoncore-3.14-64\python.exe
2026-07-24 16:20:47.834 [info] Discovered env: d:\src\vscode-bug\.venv\Scripts\python.exe
2026-07-24 16:20:47.866 [error] [pet] �[2m 0.131520500s�[0m �[31mERROR�[0m �[2mpet_python_utils::env�[0m�[2m:�[0m Failed to spawn Python to resolve info "C:\\Users\\MyUserName\\AppData\\Local\\Python\\bin\\python.exe.__target__": %1 is not a valid Win32 application. (os error 193)
�[2m 0.131563500s�[0m �[33m WARN�[0m �[2mpet::find�[0m�[2m:�[0m Unknown Python Env "C:\\Users\\MyUserName\\AppData\\Local\\Python\\bin\\python.exe.__target__"
2026-07-24 16:20:47.869 [error] [pet] �[2m 0.137766400s�[0m �[31mERROR�[0m �[2mpet_python_utils::env�[0m�[2m:�[0m Failed to spawn Python to resolve info "C:\\Users\\MyUserName\\AppData\\Local\\Python\\bin\\python3.13.exe.__target__": %1 is not a valid Win32 application. (os error 193)
�[2m 0.137799300s�[0m �[33m WARN�[0m �[2mpet::find�[0m�[2m:�[0m Unknown Python Env "C:\\Users\\MyUserName\\AppData\\Local\\Python\\bin\\python3.13.exe.__target__"
2026-07-24 16:20:47.876 [error] [pet] �[2m 0.145041700s�[0m �[31mERROR�[0m �[2mpet_python_utils::env�[0m�[2m:�[0m Failed to spawn Python to resolve info "C:\\Users\\MyUserName\\AppData\\Local\\Python\\bin\\python3.14.exe.__target__": %1 is not a valid Win32 application. (os error 193)
�[2m 0.145083400s�[0m �[33m WARN�[0m �[2mpet::find�[0m�[2m:�[0m Unknown Python Env "C:\\Users\\MyUserName\\AppData\\Local\\Python\\bin\\python3.14.exe.__target__"
2026-07-24 16:20:47.897 [info] Extension for manager ms-python.python:venv is now active.
2026-07-24 16:20:47.899 [error] [pet] �[2m 0.153364300s�[0m �[31mERROR�[0m �[2mpet_python_utils::env�[0m�[2m:�[0m Failed to spawn Python to resolve info "C:\\Users\\MyUserName\\AppData\\Local\\Python\\bin\\python3.exe.__target__": %1 is not a valid Win32 application. (os error 193)
�[2m 0.153397100s�[0m �[33m WARN�[0m �[2mpet::find�[0m�[2m:�[0m Unknown Python Env "C:\\Users\\MyUserName\\AppData\\Local\\Python\\bin\\python3.exe.__target__"
2026-07-24 16:20:49.363 [info] Resolved environment during PET refresh: d:\src\vscode-bug\.venv\Scripts\python.exe
2026-07-24 16:20:49.425 [info] Found venv environment: .venv (3.14.6.final.0)
2026-07-24 16:20:49.474 [info] Resolved Python Environment C:\Users\MyUserName\AppData\Local\Python\pythoncore-3.13-64\python.exe
2026-07-24 16:20:50.544 [info] Conda not found, turning off conda features. [Error: Conda not found
at L (c:\Users\MyUserName\.vscode\extensions\ms-python.vscode-python-envs-1.36.0-win32-x64\dist\extension.js:2:629081)
at async V (c:\Users\MyUserName\.vscode\extensions\ms-python.vscode-python-envs-1.36.0-win32-x64\dist\extension.js:2:629206)
at async t.registerCondaFeatures (c:\Users\MyUserName\.vscode\extensions\ms-python.vscode-python-envs-1.36.0-win32-x64\dist\extension.js:2:648591)
at async t.safeRegister (c:\Users\MyUserName\.vscode\extensions\ms-python.vscode-python-envs-1.36.0-win32-x64\dist\extension.js:2:290365)
at async Promise.all (index 1)
at async Immediate.<anonymous> (c:\Users\MyUserName\.vscode\extensions\ms-python.vscode-python-envs-1.36.0-win32-x64\dist\extension.js:2:782813)]
2026-07-24 16:20:50.545 [info] [interpreterSelection] Applying initial environment selection for 1 workspace folder(s)
2026-07-24 16:20:50.554 [info] Python API: Changed environment from undefined to .venv (3.14.6.final.0) for: d:\src\vscode-bug
2026-07-24 16:20:50.554 [info] Internal: Changed environment from undefined to .venv (3.14.6.final.0) for: d:\src\vscode-bug
2026-07-24 16:20:50.555 [info] [interpreterSelection] vscode-bug: .venv (3.14.6.final.0) (source: autoDiscovery)
2026-07-24 16:20:50.555 [info] [interpreterSelection] Workspace env resolved, deferring global scope to background
2026-07-24 16:20:50.560 [info] Python API: Changed environment from undefined to Python 3.13.14 for: global
2026-07-24 16:20:50.561 [info] Internal: Changed environment from undefined to Python 3.13.14 for: global
2026-07-24 16:20:50.561 [info] [interpreterSelection] global: Python 3.13.14 (source: autoDiscovery)
2026-07-24 16:20:51.141 [info] Refreshing pyenv environments
2026-07-24 16:20:51.474 [info] Pipenv not found via settings, cache, or PATH
2026-07-24 16:20:51.475 [info] Refreshing pipenv environments
2026-07-24 16:20:51.539 [info] Pipenv not found via settings, cache, or PATH
2026-07-24 16:20:51.539 [info] Found 0 pipenv environments
2026-07-24 16:20:51.592 [info] Pipenv not found via settings, cache, or PATH
2026-07-24 16:20:51.648 [info] Refreshing poetry environments
2026-07-24 16:20:51.724 [info] Poetry executable not found
2026-07-24 16:20:51.774 [info] Environment discovery complete: 4 environments found (Global: 3, venv: 1)
Environment data
Repro Steps
python.useEnvironmentsExtensionistrueuv init; uv syncorpython -mvenv .venv){ "version": "2.0.0", "tasks": [ { "label": "Test (args): OK", "type": "shell", "command": "${command:python.interpreterPath}", "args": ["-c", "import sys; print(sys.executable)", "Dummy"], "group": {"kind": "build"} }, { "label": "Test (args): ERROR (input)", "type": "shell", "command": "${command:python.interpreterPath}", "args": ["-c", "import sys; print(sys.executable)", "${input:Dummy}"], "group": {"kind": "build"} }, { "label": "Test (args): ERROR (env)", "type": "shell", "command": "${command:python.interpreterPath}", "args": ["-c", "import sys; print(sys.executable)", "${env:DUMMY}"], "group": {"kind": "build"} }, { "label": "Test (cmd): OK", "type": "shell", "command": "${command:python.interpreterPath} -c 'import sys; print(sys.executable)'", "group": {"kind": "build"} }, { "label": "Test (cmd): ERROR (env)", "type": "shell", "command": "${command:python.interpreterPath} -c 'import sys; print(sys.executable)' '${env:DUMMY}'", "group": {"kind": "build"} } ], "inputs": [ { "id": "Dummy", "type": "promptString", "description": "Dummy string for demonstration", "default": "Dummy" } ] }Expected behaviour
All tasks should use (and output) Python binary from the virtual environment (e.g.
D:\src\vscode-bug\.venv\Scripts\python.exe)Actual behavior
All tasks (labelled … OK) without additional variables in the
commandorargsrun as expected using the Python interpreter from the .venv for${command:python.interpreterPath}.All tasks (labelled … ERROR) with additional variables in the

commandorargsrun using the GLOBAL Python interpreter for${command:python.interpreterPath}.Neither the user nor the workspace setting for
python.defaultInterpreterPathare used.Logs
Error case
Running task "Test (args): ERROR (env)"
Python Environments Trace
Python Trace
Task output
Good case
Running task "Test (args): OK"
Python Environments Trace
Python Trace
Task output
Additional context
python.useEnvironmentsExtensionis set tofalsePython Environments Trace during VS Code startup