Skip to content

python.envFile does not get sourced in terminals #25350

@tibbe

Description

@tibbe

Type: Bug

Behaviour

It used to be the case that a .env file in the project root directory would get sourced when opening a new terminal in that project. This no longer happens.

Steps to reproduce:

  1. Open a new terminal in a Python project with a .env file in its root.

Diagnostic data

launch.json configuration

<No launch.json>

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

2025-08-04 10:28:43.935 [info] Python interpreter path: ./.venv/bin/python
2025-08-04 10:28:44.020 [info] > /opt/homebrew/bin/pyenv which python
2025-08-04 10:28:44.020 [info] cwd: ~/work/benetics/backend
2025-08-04 10:28:44.308 [info] > conda info --json
2025-08-04 10:28:44.457 [error] [
  'Failed to activate a workspace, Class name = v, completed in 540ms, has a falsy return value, Arg 1: <Uri:/Users/tibbe/work/benetics/backend/benetics/api/main.py>, Return Value: undefined',
  Error: command 'python.getRecommendedEnvironment' already exists
      at Ab.registerCommand (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:40266)
      at Object.registerCommand (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:164:104895)
      at p.activate (/Users/tibbe/.vscode/extensions/ms-python.python-2025.10.1-darwin-arm64/out/client/extension.js:2:529744)
      at /Users/tibbe/.vscode/extensions/ms-python.python-2025.10.1-darwin-arm64/out/client/extension.js:2:2457
      at Array.map (<anonymous>)
      at v.activateWorkspace (/Users/tibbe/.vscode/extensions/ms-python.python-2025.10.1-darwin-arm64/out/client/extension.js:2:2447)
]
2025-08-04 10:28:44.457 [info] Starting Pylance language server.
2025-08-04 10:28:53.567 [info] Python interpreter path: ~/.pyenv/versions/3.11.11/bin/python

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

XXX

Extension version: 2025.10.1
VS Code version: Code 1.102.3 (Universal) (488a1f239235055e34e673291fb8d8c810886f81, 2025-07-29T03:00:23.339Z)
OS version: Darwin arm64 24.5.0
Modes:

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

Multiroot scenario, following user settings may not apply:

languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
boto3-ide Bot 0.6.0
copilot Git 1.350.0
copilot-chat Git 0.29.1
debugpy ms- 2025.10.0
even-better-toml tam 0.21.2
gitlens eam 17.3.3
js-debug ms- 1.102.0
js-debug-companion ms- 1.1.3
jupyter ms- 2025.6.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.3.0
lldb-dap llv 0.2.15
markdown-preview-github-styles bie 2.2.0
mypy-type-checker ms- 2025.2.0
prettier-vscode esb 11.0.0
python ms- 2025.10.1
rainbow-csv mec 3.20.0
remote-containers ms- 0.422.1
rewrap stk 1.16.3
ruff cha 2025.24.0
rust-analyzer rus 0.3.2563
swift-vscode swi 2.10.0
vscode-eslint dba 3.0.10
vscode-github-actions git 0.27.2
vscode-jest Ort 6.4.4
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
vscode-lldb vad 1.11.5
vscode-pull-request-github Git 0.114.3
vscode-pylance ms- 2025.7.1
vscode-python-envs ms- 1.2.0
System Info
Item Value
CPUs Apple M1 Pro (8 x 2400)
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: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 13, 12, 16
Memory (System) 16.00GB (0.27GB free)
Process Argv --crash-reporter-id ed2662a8-8445-4e6c-a43a-bb8dbcde152c
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
h48ei257:31000450
nativeloc1:31344060
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
c7cif404:31314491
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
747dc170:31275177
6518g693:31334701
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
pylancequickfixt:31358882
9d2cg352:31346308
convertlamdaf:31358879
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31350858
b6b4d950:31327385
replacestringexc:31350595
nes-set-on:31351930
onetestforazureexp:31335613
6abeh943:31336334
yijiwantestdri0626-t:31336930
0927b901:31350571
ji9b5146:31348712
45650338:31358607
0cj2b977:31352657
gaj49834:31355361

Metadata

Metadata

Assignees

No one assigned

    Labels

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