Type: Bug
Behaviour
I use the Python Environments extension to load environment variables from a .env file. I noticed today that if I REMOVE an environment variable from the file:
- The Python Environments extension DOES NOT want to trigger a relaunch of the terminal, and
- The removed variable will persist even after the terminal is relaunched and will exist in any new terminals launched.
I set some environment variables needed for testing some code, but now I can't remove them. The old environment variables no longer present in the .env file are still injected into the terminal even after trying the following:
- Reloading the window
- Restarting VSCode
- Restarting WSL and restarting VSCode
Steps to reproduce:
- Add an env var to the .env file (e.g.
FOO="bar") and save the .env file. The Python Environments extension should want to trigger a relaunch of the terminal.
- Relaunch the terminal.
- Check that the environment variable is set in the terminal (e.g. via
export).
- Change the value of the variable the .env file (e.g.
FOO="BAR") and save the .env file. The Python Environments extension should want to trigger a relaunch of the terminal.
- Relaunch the terminal.
- Check that the environment variable is set in the terminal (e.g. via
export).
- Remove the environment variable from the .env file and save it. The Python Environments extension DOES NOT want to trigger a relaunch of the terminal.
- Relaunch the terminal.
- Verify that the removed environment variable is STILL SET in the terminal.
Diagnostic data
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
There is nothing output to the Python Output panel while performing the steps listed above.
Extension version: 2026.2.0
VS Code version: Code 1.109.4 (c3a26841a84f20dfe0850d0a5a9bd01da4f003ea, 2026-02-16T15:35:57.932Z)
OS version: Windows_NT x64 10.0.22631
Modes:
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2
- Python version (& distribution if applicable, e.g. Anaconda): 3.12.3.final.0
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): System
- Value of the
python.languageServer setting: Default
User Settings
envFile: "<placeholder>"
languageServer: "Pylance"
testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
Installed Extensions
| Extension Name |
Extension Id |
Version |
| debugpy |
ms- |
2025.18.0 |
| hexeditor |
ms- |
1.11.1 |
| insert-unicode |
bru |
0.15.1 |
| isort |
ms- |
2025.0.0 |
| java |
red |
1.52.0 |
| js-debug |
ms- |
1.105.0 |
| jupyter |
ms- |
2025.9.1 |
| jupyter-renderers |
ms- |
1.3.0 |
| live-server |
ms- |
0.4.17 |
| parquet-viewer |
dvi |
3.0.1 |
| python |
ms- |
2026.2.0 |
| rainbow-csv |
mec |
3.24.1 |
| roo-cline |
Roo |
3.49.0 |
| ruff |
cha |
2026.36.0 |
| shell-format |
fox |
7.2.8 |
| vscode-data-preview |
Ran |
2.3.0 |
| vscode-edit-csv |
jan |
0.11.8 |
| vscode-gradle |
vsc |
3.17.2 |
| vscode-graphql |
Gra |
0.13.2 |
| vscode-java-debug |
vsc |
0.58.5 |
| vscode-java-dependency |
vsc |
0.27.0 |
| vscode-java-pack |
vsc |
0.30.5 |
| vscode-java-test |
vsc |
0.44.0 |
| vscode-js-profile-table |
ms- |
1.0.10 |
| vscode-jupyter-cell-tags |
ms- |
0.1.9 |
| vscode-jupyter-slideshow |
ms- |
0.1.6 |
| vscode-langserver-shacl |
sta |
0.2.0 |
| vscode-langserver-sms |
sta |
0.2.0 |
| vscode-langserver-sparql |
sta |
0.2.1 |
| vscode-langserver-trig |
sta |
0.2.0 |
| vscode-langserver-turtle |
sta |
0.2.1 |
| vscode-maven |
vsc |
0.45.1 |
| vscode-pylance |
ms- |
2026.1.1 |
| vscode-python-envs |
ms- |
1.16.0 |
| vscode-sql-formatter |
adp |
1.4.4 |
| vscode-stardog-languages |
sta |
0.1.0 |
System Info
| Item |
Value |
| CPUs |
11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz (16 x 2496) |
| GPU Status |
2d_canvas: enabled GPU0: VENDOR= 0x10de, DEVICE=0x24b7 [NVIDIA RTX A4000 Laptop GPU], DRIVER_VENDOR=NVIDIA, DRIVER_VERSION=31.0.15.2849 ACTIVE GPU1: VENDOR= 0x8086, DEVICE=0x9a60 [Intel(R) UHD Graphics], DRIVER_VERSION=31.0.101.4575 GPU2: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.22621.5415 Machine model name: Machine model version: 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 trees_in_viz: disabled_off video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) |
undefined |
| Memory (System) |
31.48GB (13.10GB free) |
| Process Argv |
--crash-reporter-id d5bc46c6-7ee2-4441-a534-b51f433e46cc |
| Screen Reader |
no |
| VM |
0% |
| Item |
Value |
| Remote |
WSL: Ubuntu |
| OS |
Linux x64 6.6.87.2-microsoft-standard-WSL2 |
| CPUs |
11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz (16 x 0) |
| Memory (System) |
15.36GB (12.50GB free) |
| VM |
0% |
| Item |
Value |
| Remote |
WSL: Ubuntu |
| OS |
Linux x64 6.6.87.2-microsoft-standard-WSL2 |
| CPUs |
11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz (16 x 0) |
| Memory (System) |
15.36GB (12.50GB free) |
| VM |
0% |
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
4f60g487:31327383
63221493:31336333
envsdeactivate2:31464701
cloudbuttont:31379625
aihoversummaries_f:31453033
3efgi100_wstrepl:31403338
use-responses-api:31390855
anonusage:31403420
ec5jj548:31422691
cp_cls_t_966_ss:31454198
4je02754:31463857
find_all_ref_in_bg_f:31453035
a5gib710:31434435
7a04d226_do_not_restore_last_panel_session:31438103
cp_cls_c_1081:31454833
a43f0576c:31442824
e9c30283:31461165
idci7584:31464702
edit_mode_hidden:31461530
864ei723_large_tool_results_to_disk:31460878
notips:31457203
chat:31457767
Type: Bug
Behaviour
I use the Python Environments extension to load environment variables from a .env file. I noticed today that if I REMOVE an environment variable from the file:
I set some environment variables needed for testing some code, but now I can't remove them. The old environment variables no longer present in the .env file are still injected into the terminal even after trying the following:
Steps to reproduce:
FOO="bar") and save the .env file. The Python Environments extension should want to trigger a relaunch of the terminal.export).FOO="BAR") and save the .env file. The Python Environments extension should want to trigger a relaunch of the terminal.export).Diagnostic data
Output for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)There is nothing output to the Python Output panel while performing the steps listed above.
Extension version: 2026.2.0
VS Code version: Code 1.109.4 (c3a26841a84f20dfe0850d0a5a9bd01da4f003ea, 2026-02-16T15:35:57.932Z)
OS version: Windows_NT x64 10.0.22631
Modes:
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2
python.languageServersetting: DefaultUser Settings
Installed Extensions
System Info
GPU0: VENDOR= 0x10de, DEVICE=0x24b7 [NVIDIA RTX A4000 Laptop GPU], DRIVER_VENDOR=NVIDIA, DRIVER_VERSION=31.0.15.2849 ACTIVE
GPU1: VENDOR= 0x8086, DEVICE=0x9a60 [Intel(R) UHD Graphics], DRIVER_VERSION=31.0.101.4575
GPU2: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.22621.5415
Machine model name:
Machine model version:
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
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
A/B Experiments