Skip to content

Shell won't start venv after updateΒ #25285

@PotterSys

Description

@PotterSys

Type: Bug

Behaviour

Last friday, when starting a Terminal window, it ran automatically the activation script for venv on the project I'm working on.

However, today (monday) the script didn't appear. I read the Wiki page it appeared on the toaster message (https://github.com/microsoft/vscode-python/wiki/Activate-Environments-in-Terminal-Using-Environment-Variables); and therefore I ran the same command I did on friday. However, I've got an error as the terminal ran using the Python interpreter from the OS, and not the one from the virtual environment.

I tried out running the activation script and then my code, and worked as expected.

Image

Steps to reproduce:

  1. Open a new Terminal window within a project that have configured a virtual environment
  2. Run a script that uses libraries installed only on the virtual environment
Image

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-07-14 10:02:35.717 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-07-14 10:02:35.717 [info] Native locator: Refresh started
2025-07-14 10:02:35.717 [info] Native locator: Refresh started
2025-07-14 10:02:35.913 [info] > pyenv which python
2025-07-14 10:02:35.913 [info] cwd: .
2025-07-14 10:02:36.365 [info] Native locator: Refresh finished in 24750 ms
2025-07-14 10:02:36.367 [info] Python interpreter path: .\.venv\Scripts\python.exe
2025-07-14 10:02:39.729 [info] > & ./.venv/Scripts/Activate.ps1 ; echo 'e8b39361-0157-4923-80e1-22d70d46dee6' ; python ~/.vscode/extensions/ms-python.python-2025.10.0-win32-x64/python_files/printEnvVariables.py
2025-07-14 10:02:39.729 [info] shell: powershellCore
2025-07-14 10:02:41.750 [info] Starting Pylance language server.
2025-07-14 10:02:46.954 [info] > ~\AppData\Local\Microsoft\WindowsApps\python3.12.exe ~/.vscode/extensions/ms-python.python-2025.10.0-win32-x64/python_files/printEnvVariables.py
2025-07-14 10:02:46.954 [info] shell: powershellCore
2025-07-14 10:02:52.471 [info] Setting environment variable DB_ORACLE_LIBDIR in collection to C:\\Projects\\2025\\07\\[project name]\\libs\\ora_instantclient_11_2 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:02:52.471 [info] Setting environment variable DB_ORACLE_PASS in collection to RRHH {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:02:52.471 [info] Setting environment variable DB_ORACLE_TNS in collection to BASEPROD {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:02:52.471 [info] Setting environment variable DB_ORACLE_TNSDIR in collection to C:\\Projects\\2025\\07\\[project name]\\config {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:02:52.471 [info] Setting environment variable DB_ORACLE_USER in collection to RRHH {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:02:52.471 [info] Prepending environment variable PATH in collection with c:\Users\[username]\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\deactivate\powershell;C:\Projects\2025\07\[project name]\.venv\Scripts; {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:02:52.471 [info] Setting environment variable VIRTUAL_ENV in collection to C:\Projects\2025\07\[project name]\.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:02:52.471 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to .venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:02:52.474 [info] Send text to terminal: & C:/Users/[username]/AppData/Local/Microsoft/WindowsApps/python3.12.exe c:\Users\[username]\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\printEnvVariablesToFile.py c:\Users\[username]\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\deactivate\powershell\envVars.txt
2025-07-14 10:16:37.547 [info] Discover tests for workspace name: [project name] - uri: c:\Projects\2025\07\[project name]\inc\pdf.py
2025-07-14 10:18:09.271 [info] Discover tests for workspace name: [project name] - uri: c:\Projects\2025\07\[project name]\inc\creator.py
2025-07-14 10:18:50.956 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-07-14 10:18:50.956 [info] Native locator: Refresh started
2025-07-14 10:18:50.956 [info] Native locator: Refresh started
2025-07-14 10:18:51.181 [info] > pyenv which python
2025-07-14 10:18:51.181 [info] cwd: .
2025-07-14 10:18:51.434 [info] Python interpreter path: .\.venv\Scripts\python.exe
2025-07-14 10:18:51.442 [info] Native locator: Refresh finished in 9774 ms
2025-07-14 10:18:51.988 [info] > & ./.venv/Scripts/Activate.ps1 ; echo 'e8b39361-0157-4923-80e1-22d70d46dee6' ; python ~/.vscode/extensions/ms-python.python-2025.10.0-win32-x64/python_files/printEnvVariables.py
2025-07-14 10:18:51.988 [info] shell: powershellCore
2025-07-14 10:18:55.375 [info] > ~\AppData\Local\Microsoft\WindowsApps\python3.12.exe ~/.vscode/extensions/ms-python.python-2025.10.0-win32-x64/python_files/printEnvVariables.py
2025-07-14 10:18:55.375 [info] shell: powershellCore
2025-07-14 10:18:57.870 [info] Starting Pylance language server.
2025-07-14 10:18:59.154 [info] Setting environment variable DB_ORACLE_LIBDIR in collection to C:\\Projects\\2025\\07\\[project name]\\libs\\ora_instantclient_11_2 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:18:59.154 [info] Setting environment variable DB_ORACLE_PASS in collection to RRHH {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:18:59.154 [info] Setting environment variable DB_ORACLE_TNS in collection to BASEPROD {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:18:59.154 [info] Setting environment variable DB_ORACLE_TNSDIR in collection to C:\\Projects\\2025\\07\\[project name]\\config {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:18:59.154 [info] Setting environment variable DB_ORACLE_USER in collection to RRHH {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:18:59.154 [info] Prepending environment variable PATH in collection with c:\Users\[username]\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\deactivate\powershell;C:\Projects\2025\07\[project name]\.venv\Scripts; {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:18:59.154 [info] Setting environment variable VIRTUAL_ENV in collection to C:\Projects\2025\07\[project name]\.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:18:59.154 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to .venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-14 10:18:59.156 [info] Send text to terminal: & C:/Users/[username]/AppData/Local/Microsoft/WindowsApps/python3.12.exe c:\Users\[username]\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\printEnvVariablesToFile.py c:\Users\[username]\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\deactivate\powershell\envVars.txt

Output for Terminal

PS C:\Projects\2025\07\[project name]> python .\main.py
Traceback (most recent call last):
  File "C:\Projects\2025\07\[project name]\main.py", line 3, in <module>
    from inc.oracledb import OracleDb
  File "C:\Projects\2025\07\[project name]\inc\oracledb.py", line 1, in <module>
    from sqlalchemy import create_engine, URL as urnBuilder, insert, MetaData as alchemyMetadata, Table, text
ModuleNotFoundError: No module named 'sqlalchemy'

Extension version: 2025.10.0
VS Code version: Code 1.102.0 (cb0c47c0cfaad0757385834bd89d410c78a856c0, 2025-07-09T22:10:34.600Z)
OS version: Windows_NT x64 10.0.22621
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.10
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
autodocstring njp 0.6.1
Bookmarks ale 13.5.0
csdevkit ms- 1.30.44
csharp ms- 2.84.19
debugpy ms- 2025.10.0
es7-react-js-snippets dsz 4.4.3
gitlens eam 17.3.0
indent-rainbow ode 8.3.1
JavaScriptSnippets xab 1.8.0
js-debug ms- 1.102.0
js-debug-companion ms- 1.1.3
openapi-preview zoe 2.3.0
prettier-vscode esb 11.0.0
python ms- 2025.10.0
python-path mge 0.0.14
python-resource-monitor kai 0.3.0
python-snippets cst 0.1.2
remote-wsl ms- 0.99.0
sql-developer Ora 25.2.0
vetur oct 0.37.3
vsc-python-indent Kev 1.21.0
vscode-containers ms- 2.0.3
vscode-dotnet-runtime ms- 2.3.6
vscode-eslint dba 3.0.10
vscode-html-css ecm 2.0.13
vscode-js-profile-table ms- 1.0.10
vscode-openapi 42C 4.37.2
vscode-oracle-format mp 0.1.5
vscode-pylance ms- 2025.6.2
vscode-python-envs ms- 0.3.11841011
vscode-xml red 0.29.0
vscode-yaml red 1.18.0
xml Dot 2.5.1
System Info
Item Value
CPUs Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz (4 x 2904)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.89GB (5.63GB free)
Process Argv --crash-reporter-id 65197e54-e930-40da-99a9-0845801a5d11
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
2e7ec940:31000449
cppperfnew:31000557
dwnewjupyter:31046869
nativeloc1:31344060
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
hdaa2157:31222309
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
c7cif404:31314491
pythonpulldiag:31343502
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
747dc170:31275177
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
pylancequickfixt:31329274
9d2cg352:31346308
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31335815
nes-diff-11:31337487
63221493:31336333
yijiwantestdri0626-t:31336930
f76d9909:31342392

Metadata

Metadata

Assignees

Labels

info-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