Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

VScode complains about being unable to find virtual python environment #25139

Copy link
Copy link
Open
@antspy

Description

@antspy
Issue body actions

Type: Bug

I find the exact same behavior as
#21907

In short, VSCode will randomly complain on opening that it cannot find the python interpreter I select in the settings:

Failed to check if /workspaces/xxx/.python_env.venv/bin/python is an executable

[Error: ENOENT: no such file or directory, lstat '/workspaces/xxx/.python_env.venv/bin/python'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/workspaces/xxx/.python_env.venv/bin/python'
}

My settings.json contains

"python.defaultInterpreterPath": "${workspaceFolder}/.python_env.venv/bin/python",

And of course the /workspaces/xxx/.python_env.venv/bin/python binary exists and I can run it from the terminal without issues. As I said, it's the same behavior that was raised in #21907

Some additional info:

  1. I am using devcontainers
  2. The python interpreter might not exist the very first time the container is created. It is created instead right after (in the post_create step of the devcontainers setup).
  3. After creating the python environment (either in the post_create step or manually), if I restart VSCode, then usually it is able to find the interpreter correctly, but not always. Sometimes it just flat out refuses to do so, and I need to reload multiple times. This feels like some settings got corrupted somewhere (perhaps because the very first time it tries to do it, the environment is not available? and some things are cached and break the normal logic?)

When it enters the corrupted state, only a reload would do. Even if I manually select the interpreter from the UI, it refuses to believe it exists (and raises the error I pasted above, saying that lstat says it cannot find the path).

Would love a resolution of this!

Extension version: 2025.6.1
VS Code version: Code 1.100.2 (Universal) (848b80aeb52026648a8ff9f7c45a9b0a80641e2e, 2025-05-14T21:47:40.416Z)
OS version: Darwin arm64 24.5.0
Modes:
Remote OS version: Linux x64 6.8.0-52-generic

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


languageServer: "Pylance"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
• autoTestDiscoverOnSavePattern: "<placeholder>"

Installed Extensions
Extension Name Extension Id Version
atlas-hcl Ari 0.7.2
autodocstring njp 0.6.1
debugpy ms- 2025.8.0
even-better-toml tam 0.21.2
git-worktrees Git 2.2.0
go gol 0.46.1
hcl has 0.6.0
jinjahtml sam 0.20.0
js-debug ms- 1.100.1
jupyter ms- 2025.4.1
jupyter-renderers ms- 1.1.0
markdown-all-in-one yzh 3.6.3
npm-intellisense chr 1.4.5
prettier-sql-vscode inf 1.6.0
prettier-vscode esb 11.0.0
python ms- 2025.6.1
rainbow-csv mec 3.19.0
ruff cha 2025.22.0
RunOnSave eme 0.2.7
shell-format fox 7.2.5
shellcheck tim 0.37.7
terraform has 2.34.4
vscode-bazel Baz 0.11.0
vscode-buf buf 0.7.2
vscode-containers ms- 2.0.2
vscode-css-modules cli 0.5.4
vscode-docker ms- 2.0.0
vscode-env Iro 0.1.0
vscode-eslint dba 3.0.10
vscode-github-actions git 0.27.1
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.60.0
vscode-postgres cko 1.4.3
vscode-pull-request-github Git 0.110.0
vscode-pylance ms- 2025.5.1
vscode-yaml red 1.18.0
System Info
Item Value
CPUs Apple M2 Pro (12 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: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 2, 2, 2
Memory (System) 16.00GB (0.07GB free)
Process Argv --crash-reporter-id 54172603-de0d-47aa-9334-9d80e622f0a2
Screen Reader no
VM 0%
Item Value
Remote Dev Container: Ubuntu @ hetzner
OS Linux x64 6.8.0-52-generic
CPUs AMD EPYC Processor (8 x 0)
Memory (System) 15.25GB (11.17GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
vscrpc:30673769
962ge761:30959799
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
pythonrstrctxt:31112756
nativeloc2:31192216
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
9064b325:31222308
copilot_t_ci:31222730
e5gg6876:31282496
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
c7cif404:31314491
996jf627:31283433
pythonrdcb7cf:31303019
usemplatestapi:31297334
0aa6g176:31307128
7bj51361:31289155
747dc170:31275177
pylancecolor:31314202
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
gendocf:31295004

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugtriage-neededNeeds assignment to the proper sub-teamNeeds 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

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.