Skip to content

VS Code cannot find the environment unless I reload it after trusting the workspace #24928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ral-fi opened this issue Jan 24, 2025 · 1 comment
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team

Comments

@ral-fi
Copy link

ral-fi commented Jan 24, 2025

Type: Bug

Hi, when I click on a .ipynb file to open it, VS Code wants me to trust the workspace. However, after I trust the workspace and now need to select a kernel, hence environment to run the code, it cannot find the environment unless I "reload the window". I do not remember this happening for a few years now. Clearly, it is not because of python, jupyter or VS code version because I have tried reinstalling everything.

How can solve this so that I don't have to do this every time I open VS Code. I would appreciate any help, thanks.

VS Code version: Code 1.96.4 (cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba, 2025-01-16T00:16:19.038Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-14700K (28 x 3418)
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.64GB (20.31GB free)
Process Argv --crash-reporter-id cd02c922-1ea9-4540-bee0-fc52a3ca0fb7
Screen Reader no
VM 0%
Extensions (8)
Extension Author (truncated) Version
debugpy ms- 2024.14.0
python ms- 2024.22.2
vscode-pylance ms- 2024.12.1
jupyter ms- 2024.11.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.0.21
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupytercf:31046870
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc1:31192215
cf971741:31144450
iacca1:31171482
notype1:31157159
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624
dwoutputs:31217127
9064b325:31222308
copilot_t_ci:31222730

@vs-code-engineering vs-code-engineering bot added the triage-needed Needs assignment to the proper sub-team label Jan 24, 2025
@joyceerhl joyceerhl assigned rebornix and unassigned joyceerhl Jan 25, 2025
@vs-code-engineering vs-code-engineering bot removed the triage-needed Needs assignment to the proper sub-team label Jan 25, 2025
@rebornix rebornix added the bug Issue identified by VS Code Team member as probable bug label Mar 24, 2025
@rebornix rebornix assigned DonJayamanne and unassigned rebornix Mar 24, 2025
@DonJayamanne
Copy link

@karthiknadig Looks like an issue in Python extension API (or the like)
From what I can tell the problem is in pythonEnvironments..initialize
The return value api of getNativePythonFinder is cached.
And when we trust the workspace, the same api object is returned.

Easy to repro and validate

  • Open untrusted workspace
  • Trust the workspace
  • Open a notebook and go into kernel Picker -> Python Environment
  • Click the refresh icon on the top right of the kernel picker
  • Look at the logs in Python extension
2025-03-26 09:49:46.806 [info] Native locator: Refresh started
2025-03-26 09:49:46.809 [error] Python discovery not supported in untrusted workspace
2025-03-26 09:49:46.810 [info] Native locator: Refresh finished in 4 ms

Basically even after trusting the workspace and calling the Python API, the Python extension thinks the workspace is not trusted and logs errors.

@DonJayamanne DonJayamanne removed their assignment Mar 25, 2025
@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode Mar 25, 2025
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Mar 25, 2025
@karthiknadig karthiknadig self-assigned this Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

5 participants