Skip to content

VSCode showing the wrong Python version after devcontainer rebuild #23725

@syagev

Description

@syagev

Type: Bug

Behaviour

VSCode shows the wrong Python version in he python env selection command options, in the bottom right status bar, and also in the start message in a Jupyter Interactive Window

Steps to reproduce:

  1. In a remote tunnel, open a repo in a devcontainer with Python 3.11
  2. From within that container, change the Python feature in .devcontainer.json to 3.10
  3. Rebuild container

Diagnostic data

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

2024-06-30 19:48:29.969 [info] Experiment 'pythonCreateEnvOnPipInstall' is active
2024-06-30 19:48:29.969 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-06-30 19:48:29.969 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-06-30 19:48:29.969 [info] Experiment 'pythonTestAdapter' is active
2024-06-30 19:48:30.065 [info] Default formatter is set to ms-python.autopep8 for workspace /workspaces/batman
2024-06-30 19:48:30.615 [info] Python interpreter path: /batman_dev/venv/batman/bin/python
2024-06-30 19:48:31.577 [info] Starting Environment refresh
2024-06-30 19:48:31.577 [info] Searching for interpreters in posix paths locator
2024-06-30 19:48:31.580 [info] Searching for pyenv environments
2024-06-30 19:48:31.580 [info] Searching for conda environments
2024-06-30 19:48:31.580 [info] Searching for global virtual environments
2024-06-30 19:48:31.580 [info] Searching for custom virtual environments
2024-06-30 19:48:31.585 [info] pyenv is not installed
2024-06-30 19:48:31.585 [info] Finished searching for pyenv environments: 7 milliseconds
2024-06-30 19:48:31.586 [info] Finished searching for custom virtual envs: 7 milliseconds
2024-06-30 19:48:31.592 [info] Finished searching for global virtual envs: 13 milliseconds
2024-06-30 19:48:32.200 [info] Found: /usr/local/python/current/bin/python --> /usr/local/python/3.10.14/bin/python3.10
2024-06-30 19:48:32.208 [info] Found: /usr/local/python/current/bin/python3 --> /usr/local/python/current/bin/python3.10
2024-06-30 19:48:32.209 [info] Found: /usr/local/python/current/bin/python3.10 --> /usr/local/python/current/bin/python3.10
2024-06-30 19:48:32.217 [info] Finished searching for interpreters in posix paths locator: 640 milliseconds
2024-06-30 19:48:32.637 [info] > hatch env show --json
2024-06-30 19:48:32.637 [info] cwd: .
2024-06-30 19:48:32.644 [info] > conda info --json
2024-06-30 19:48:32.649 [info] Environments refresh paths discovered (event): 1073 milliseconds
2024-06-30 19:48:32.649 [info] Environments refresh paths discovered: 1073 milliseconds
2024-06-30 19:48:32.730 [info] > /usr/local/python/current/bin/python -I ~/.vscode-server/extensions/ms-python.python-2024.8.1/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2024.8.1/python_files/interpreterInfo.py
2024-06-30 19:48:32.736 [info] > pyenv which python
2024-06-30 19:48:32.737 [info] cwd: .
2024-06-30 19:48:32.767 [info] > /usr/local/python/current/bin/python3 -I ~/.vscode-server/extensions/ms-python.python-2024.8.1/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2024.8.1/python_files/interpreterInfo.py
2024-06-30 19:48:32.807 [info] Environments refresh finished (event): 1230 milliseconds
2024-06-30 19:48:32.812 [info] Environment refresh took 1237 milliseconds
2024-06-30 19:48:34.112 [info] > . /batman_dev/venv/batman/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode-server/extensions/ms-python.python-2024.8.1/python_files/printEnvVariables.py
2024-06-30 19:48:34.112 [info] shell: bash
2024-06-30 19:48:34.252 [info] > . /batman_dev/venv/batman/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode-server/extensions/ms-python.python-2024.8.1/python_files/printEnvVariables.py
2024-06-30 19:48:34.252 [info] shell: bash
2024-06-30 19:48:34.294 [info] > /usr/local/python/current/bin/python3 ~/.vscode-server/extensions/ms-python.python-2024.8.1/python_files/printEnvVariables.py
2024-06-30 19:48:34.295 [info] shell: bash
2024-06-30 19:48:34.326 [info] Setting environment variable AWS_DEFAULT_PROFILE in collection to ec2PowerUser-778255911966 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-06-30 19:48:34.326 [info] Setting environment variable VIRTUAL_ENV in collection to /batman_dev/venv/batman {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-06-30 19:48:34.326 [info] Setting environment variable PYTHONPATH in collection to research_pipeline:. {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-06-30 19:48:34.326 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to (batman)  {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-06-30 19:48:34.326 [info] Prepending environment variable PS1 in collection with (batman)  {"applyAtShellIntegration":true,"applyAtProcessCreation":false}
2024-06-30 19:48:34.326 [info] Prepending environment variable PATH in collection with /root/.vscode-server/extensions/ms-python.python-2024.8.1/python_files/deactivate/bash:/batman_dev/venv/batman/bin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-06-30 19:48:34.327 [info] Send text to terminal: /usr/local/python/current/bin/python3 /root/.vscode-server/extensions/ms-python.python-2024.8.1/python_files/printEnvVariablesToFile.py /root/.vscode-server/extensions/ms-python.python-2024.8.1/python_files/deactivate/bash/envVars.txt
2024-06-30 19:48:35.060 [info] Starting Pylance language server.
2024-06-30 19:49:19.289 [info] > . /batman_dev/venv/batman/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode-server/extensions/ms-python.python-2024.8.1/python_files/printEnvVariables.py
2024-06-30 19:49:19.289 [info] shell: bash
2024-06-30 19:50:23.215 [info] Starting Environment refresh
2024-06-30 19:50:23.215 [info] Searching for interpreters in posix paths locator
2024-06-30 19:50:23.216 [info] Searching for pyenv environments
2024-06-30 19:50:23.216 [info] Searching for conda environments
2024-06-30 19:50:23.216 [info] Searching for global virtual environments
2024-06-30 19:50:23.216 [info] Searching for custom virtual environments
2024-06-30 19:50:23.217 [info] pyenv is not installed
2024-06-30 19:50:23.217 [info] Finished searching for pyenv environments: 2 milliseconds
2024-06-30 19:50:23.217 [info] Finished searching for custom virtual envs: 1 milliseconds
2024-06-30 19:50:23.217 [info] Finished searching for global virtual envs: 2 milliseconds
2024-06-30 19:50:23.234 [info] Found: /usr/local/python/current/bin/python --> /usr/local/python/3.10.14/bin/python3.10
2024-06-30 19:50:23.235 [info] Found: /usr/local/python/current/bin/python3 --> /usr/local/python/current/bin/python3.10
2024-06-30 19:50:23.235 [info] Found: /usr/local/python/current/bin/python3.10 --> /usr/local/python/current/bin/python3.10
2024-06-30 19:50:23.236 [info] Finished searching for interpreters in posix paths locator: 22 milliseconds
2024-06-30 19:50:23.243 [info] Environments refresh paths discovered (event): 29 milliseconds
2024-06-30 19:50:23.243 [info] Environments refresh finished (event): 29 milliseconds
2024-06-30 19:50:23.243 [info] Environments refresh paths discovered: 29 milliseconds
2024-06-30 19:50:23.245 [info] Environment refresh took 31 milliseconds
2024-06-30 19:50:25.119 [info] Starting Environment refresh
2024-06-30 19:50:25.119 [info] Searching for interpreters in posix paths locator
2024-06-30 19:50:25.119 [info] Searching for pyenv environments
2024-06-30 19:50:25.119 [info] Searching for conda environments
2024-06-30 19:50:25.119 [info] Searching for global virtual environments
2024-06-30 19:50:25.119 [info] Searching for custom virtual environments
2024-06-30 19:50:25.120 [info] pyenv is not installed
2024-06-30 19:50:25.120 [info] Finished searching for pyenv environments: 1 milliseconds
2024-06-30 19:50:25.121 [info] Finished searching for custom virtual envs: 2 milliseconds
2024-06-30 19:50:25.122 [info] Finished searching for global virtual envs: 3 milliseconds
2024-06-30 19:50:25.135 [info] Found: /usr/local/python/current/bin/python --> /usr/local/python/3.10.14/bin/python3.10
2024-06-30 19:50:25.136 [info] Found: /usr/local/python/current/bin/python3 --> /usr/local/python/current/bin/python3.10
2024-06-30 19:50:25.136 [info] Found: /usr/local/python/current/bin/python3.10 --> /usr/local/python/current/bin/python3.10
2024-06-30 19:50:25.136 [info] Finished searching for interpreters in posix paths locator: 18 milliseconds
2024-06-30 19:50:25.143 [info] Environments refresh paths discovered (event): 24 milliseconds
2024-06-30 19:50:25.143 [info] Environments refresh finished (event): 24 milliseconds
2024-06-30 19:50:25.143 [info] Environments refresh paths discovered: 25 milliseconds
2024-06-30 19:50:25.144 [info] Environment refresh took 26 milliseconds

Extension version: 2024.8.1
VS Code version: Code 1.90.2 (5437499feb04f7a586f677b155b039bc2b3669eb, 2024-06-18T22:34:26.404Z)
OS version: Windows_NT x64 10.0.22631
Modes:
Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2
Remote OS version: Linux x64 6.8.0-1009-aws

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.9
  • 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
autopep8 ms-python.autopep8 2024.0.0
AWS Toolkit amazonwebservices.aws-toolkit-vscode 3.12.0
GitHub Copilot GitHub.copilot 1.208.0
GitHub Copilot Chat GitHub.copilot-chat 0.16.1
JavaScript Debugger ms-vscode.js-debug 1.90.0
Jupyter ms-toolsai.jupyter 2024.5.0
Jupyter Cell Tags ms-toolsai.vscode-jupyter-cell-tags 0.1.9
Jupyter Notebook Renderers ms-toolsai.jupyter-renderers 1.0.18
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
Pylance ms-python.vscode-pylance 2024.6.1
Python ms-python.python 2024.8.1
Python Debugger ms-python.debugpy 2024.6.0
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.9
System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i9-12950HX (24 x 2496)
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
Load (avg) undefined
Memory (System) 127.67GB (86.39GB free)
Process Argv --crash-reporter-id 7a683ffe-ed86-4a3e-874f-e3e57dfd3491
Screen Reader no
VM 0%
Item Value
Remote Dev Container: Batman
OS Linux x64 5.15.153.1-microsoft-standard-WSL2
CPUs 12th Gen Intel(R) Core(TM) i9-12950HX (24 x 0)
Memory (System) 62.64GB (58.64GB free)
VM 0%
Item Value
Remote Dev Container: Batman @ ec2-yolky-dev
OS Linux x64 6.8.0-1009-aws
CPUs Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz (32 x 3000)
Memory (System) 239.85GB (235.52GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
jchc7451:31067544
chatpanelt:31048053
dsvsc021:30996838
9c06g630:31013171
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
2f103344:31071589
legacy_priority:31082724

Metadata

Metadata

Assignees

Labels

area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable buginfo-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