Skip to content

bug/regression: symlink not properly resolved for python virtual environments #196

@manlaya

Description

@manlaya

Type: Bug

Behaviour

I have python environments in my computer, all have been symlinked to ~/envs folder (under WSL2 Debian when on Windows ; under Fedora Workstation 41 and Ubuntu 22.04 when on Linux).
When working in any directory of my computer and selecting the python interpreter, the automatic scan used to find the symlinks to environments in my home folder (tested with vscode v1.98.0 and v1.91.1).
These symlinks are not detected anymore. It only works if the folder in ~/envs is not a symlink.

Bug happens since python extension version > 2024.16.

In the output log, the search for environment find ~/envs/am which is not a symlink but
can't find ~/envs/gm which is a symlink.

The bug also happen with a "fresh" vscode (only python extension installed).

Steps to reproduce:

  1. create a virtual environment with venv in any folder
  2. symlink it into $HOME/envs
  3. open vscode in another folder and hit "select python interpreter"
  4. the scan of python environment should see the links in ~/envs/

Diagnostic data

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

2025-03-06 21:42:03.651 [info] Starting Pylance language server.
2025-03-06 21:42:23.988 [info] Starting Environment refresh
2025-03-06 21:42:23.988 [info] Searching for interpreters in posix paths locator
2025-03-06 21:42:23.990 [info] Searching for pyenv environments
2025-03-06 21:42:23.990 [info] Searching for conda environments
2025-03-06 21:42:23.990 [info] Searching for global virtual environments
2025-03-06 21:42:23.990 [info] Searching for custom virtual environments
2025-03-06 21:42:24.109 [info] > hatch env show --json
2025-03-06 21:42:24.109 [info] cwd: .
2025-03-06 21:42:24.112 [info] pyenv is not installed
2025-03-06 21:42:24.112 [info] Finished searching for pyenv environments: 123 milliseconds
2025-03-06 21:42:24.140 [info] Found: /bin/python2 --> /usr/bin/python2.7
2025-03-06 21:42:24.141 [info] Found: /bin/python2.7 --> /bin/python2.7
2025-03-06 21:42:24.144 [info] Found: /bin/python3 --> /bin/python3.11
2025-03-06 21:42:24.145 [info] Found: /bin/python3.11 --> /bin/python3.11
2025-03-06 21:42:24.271 [info] Found: /usr/bin/python2 --> /usr/bin/python2.7
2025-03-06 21:42:24.272 [info] Found: /usr/bin/python2.7 --> /usr/bin/python2.7
2025-03-06 21:42:24.272 [info] Found: /usr/bin/python3 --> /usr/bin/python3.11
2025-03-06 21:42:24.272 [info] Found: /usr/bin/python3.11 --> /usr/bin/python3.11
2025-03-06 21:42:24.297 [info] > /bin/python3 -I ~/.vscode-server/extensions/ms-python.python-2025.2.0-linux-x64/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2025.2.0-linux-x64/python_files/interpreterInfo.py
2025-03-06 21:42:24.306 [info] Finished searching for conda environments: 313 milliseconds
2025-03-06 21:42:24.306 [info] > ~/miniforge3/bin/python -I ~/.vscode-server/extensions/ms-python.python-2025.2.0-linux-x64/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2025.2.0-linux-x64/python_files/interpreterInfo.py
2025-03-06 21:42:24.312 [info] Finished searching for global virtual envs: 323 milliseconds
2025-03-06 21:42:24.334 [info] Finished searching for custom virtual envs: 344 milliseconds
2025-03-06 21:42:24.362 [info] > ~/miniforge3/envs/mart/bin/python -I ~/.vscode-server/extensions/ms-python.python-2025.2.0-linux-x64/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2025.2.0-linux-x64/python_files/interpreterInfo.py
2025-03-06 21:42:24.374 [info] > ~/envs/am/bin/python -I ~/.vscode-server/extensions/ms-python.python-2025.2.0-linux-x64/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2025.2.0-linux-x64/python_files/interpreterInfo.py

Extension version: 2025.0.0
VS Code version: Code 1.98.0 (6609ac3d66f4eade5cf376d1cb76f13985724bcb, 2025-03-04T21:06:18.612Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 5.15.167.4-microsoft-standard-WSL2

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


venvPath: "<placeholder>"

venvFolders: "<placeholder>"

languageServer: "Pylance"

terminal
• launchArgs: "<placeholder>"

Installed Extensions
Extension Name Extension Id Version
autodocstring njp 0.6.1
cmake twx 0.0.17
cmake-tools ms- 1.20.53
comment-box Sly 2.4.0
cpptools ms- 1.23.6
cpptools-extension-pack ms- 1.3.1
datawrangler ms- 1.20.1
debugpy ms- 2025.4.0
even-better-toml tam 0.21.2
fileheadercomment doi 0.0.5
githistory don 0.6.20
gitignore cod 0.10.0
js-debug ms- 1.97.1
jupyter ms- 2025.2.0
jupyter-renderers ms- 1.1.0
latex-workshop Jam 10.8.0
linter-gfortran for 3.2.0
makefile-tools ms- 0.12.17
mesonbuild mes 1.27.0
path-autocomplete ion 1.25.0
python ms- 2025.2.0
rainbow-csv mec 3.17.0
shebang-snippets rpi 1.1.0
vscode-innosetup cho 1.9.3
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
vscode-markdownlint Dav 0.59.0
vscode-pylance ms- 2025.3.1
System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i5-13600H (16 x 3302)
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) 31.69GB (18.67GB free)
Process Argv
Screen Reader no
VM 0%
Item Value
Remote WSL: Debian
OS Linux x64 5.15.167.4-microsoft-standard-WSL2
CPUs 13th Gen Intel(R) Core(TM) i5-13600H (16 x 0)
Memory (System) 21.21GB (19.79GB free)
VM 0%

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions