microsoft/vscode-jupyter

Failure in listKernelsImplementation, perrmission error

Closed this issue · 6 comments

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

Context

  • System wide installation of VS Code in C:\Program Files\Microsoft VS Code\
  • Extensions and settings of VS Code in User Home Folder, for each User
  • Jupyter Extension installed for user
  • VS Code started with user priviledge

Problem explanation

Since the last update of VS Code we get a problem while selecting a Kernel for the Jupyter notebook in VS Code.

  • When starting the Notebook, no Kernel is defined, even though I defined a default interpreter for the workspace:
    Image

  • Then when I execute th first cell I get prompted to define a kernel:
    Image

  • I then select the kernel:
    Image

  • but still no Kernel gets selected and the cell doesn't get executed:
    Image

The Jupyter Logs state that there is a write error while writting to "C:\Program Files\Microsoft VS Code\~"
Could it be, that VS Code tries to write something in the Installation folder?

VS Code Version

1.94.2

Jupyter Extension Version

2024.9.1.

Jupyter logs

Visual Studio Code (1.94.2, undefined, desktop)
Jupyter Extension Version: 2024.9.1.
Python Extension Version: 2024.16.1.
Pylance Extension Version: 2024.10.1.
Platform: win32 (x64).
Temp Storage folder masked_user\Profile\AppData\Code\User\globalStorage\ms-toolsai.jupyter\version-2024.9.1
Multiple Workspace folders opened e:\Projekte\masked\scripts\python, e:\Projekte\masked\Daten\Modelle
12:21:00.767 [error] Failure in listKernelsImplementation [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Microsoft VS Code~'] {
errno: -4048,
code: 'EPERM',
syscall: 'mkdir',
path: 'C:\Program Files\Microsoft VS Code\~'
}

Coding Language and Runtime Version

Python v3.12

Language Extension Version (if applicable)

2024.16.1.

Anaconda Version (if applicable)

conda: 24.7.1

Running Jupyter locally or remotely?

Local

Please could you enable logging as follows:

  • Open settings & go into Jupyter->Logging
  • Change the value to trace
  • Reload VS Code,
  • Attempt to repro the issue & then copy the output from the Jupyter output panel (use the command Jupyter: Show Output to get to the logs).

Okay here's the log

Visual Studio Code (1.94.2, undefined, desktop)
Jupyter Extension Version: 2024.9.1.
Python Extension Version: 2024.16.1.
Pylance Extension Version: 2024.10.1.
Platform: win32 (x64).
Temp Storage folder ms2134\Profile\AppData\Code\User\globalStorage\ms-toolsai.jupyter\version-2024.9.1
Multiple Workspace folders opened e:\max_schmit\Projekte\StressRes\scripts\python, e:\max_schmit\Projekte\StressRes\Daten\Modelle\RoGeR-toolbox
13:00:48.206 [debug] Start refreshing Kernel Picker (1728903648206)
13:00:48.283 [trace] Search for KernelSpecs in Interpreter e:\max_schmit\py_venv\geo_p310\Scripts\python.exe
13:00:48.286 [trace] Search for KernelSpecs in Interpreter c:\Program Files\Python310\python.exe
13:00:48.288 [trace] Search for KernelSpecs in Interpreter c:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe
13:00:48.290 [trace] Search for KernelSpecs in Interpreter c:\Conda\python.exe
13:00:48.292 [trace] Search for KernelSpecs in Interpreter d:\conda_envs\anaconda-navigator\python.exe
13:00:48.294 [trace] Search for KernelSpecs in Interpreter d:\conda_envs\geo_p38\python.exe
13:00:48.296 [trace] Search for KernelSpecs in Interpreter d:\conda_envs\qgis\python.exe
13:00:48.303 [trace] Search for KernelSpecs in Interpreter e:\max_schmit\conda_envs\geo_p310\python.exe
13:00:48.306 [trace] Search for KernelSpecs in Interpreter e:\max_schmit\conda_envs\geo_p38\python.exe
13:00:48.309 [trace] Search for KernelSpecs in Interpreter d:\conda_envs\geo_p312\python.exe
13:00:48.311 [trace] Search for KernelSpecs in Interpreter d:\conda_envs\geo_p310\python.exe
13:00:48.314 [trace] Search for KernelSpecs in Interpreter d:\conda_envs\roger_all_p310\python.exe
13:00:48.316 [trace] Search for KernelSpecs in Interpreter c:\ProgramData\spyder-6\python.exe
13:00:48.318 [trace] Search for KernelSpecs in Interpreter c:\ProgramData\spyder-6\envs\spyder-runtime\python.exe
13:00:48.323 [debug] Get Custom Env Variables, Class name = Cm, completed in 118ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
13:00:48.323 [debug] Jupyter Paths kernels: 
13:00:48.324 [debug] Kernel Spec Root Paths, ~\AppData\Roaming\jupyter\kernels, c:\ProgramData\jupyter\kernels
13:00:49.426 [error] Failure in listKernelsImplementation [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Microsoft VS Code\~'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'mkdir',
  path: 'C:\\Program Files\\Microsoft VS Code\\~'
}
13:00:49.427 [debug] End refreshing Kernel Picker (1728903648206)
13:00:49.429 [trace] Hiding default KernelSpec python for interpreter e:\max_schmit\py_venv\geo_p310\Scripts\python.exe (KernelSpec file e:\max_schmit\py_venv\geo_p310\share\jupyter\kernels\python3\kernel.json)
13:00:49.431 [trace] Hiding default KernelSpec d:\conda_envs\geo_p38\python.exe for interpreter d:\conda_envs\geo_p38\python.exe (KernelSpec file d:\conda_envs\geo_p38\share\jupyter\kernels\python3\kernel.json)
13:00:49.433 [trace] Hiding default KernelSpec d:\conda_envs\roger_all_p310\python.exe for interpreter d:\conda_envs\roger_all_p310\python.exe (KernelSpec file d:\conda_envs\roger_all_p310\share\jupyter\kernels\python3\kernel.json)
13:00:49.434 [trace] Hiding default KernelSpec e:\max_schmit\conda_envs\geo_p38\python.exe for interpreter e:\max_schmit\conda_envs\geo_p38\python.exe (KernelSpec file e:\max_schmit\conda_envs\geo_p38\share\jupyter\kernels\python3\kernel.json)
13:00:49.436 [trace] Hiding default KernelSpec c:\ProgramData\spyder-6\envs\spyder-runtime\python.exe for interpreter c:\ProgramData\spyder-6\envs\spyder-runtime\python.exe (KernelSpec file c:\ProgramData\spyder-6\envs\spyder-runtime\share\jupyter\kernels\python3\kernel.json)
13:00:49.438 [trace] Hiding default KernelSpec e:\max_schmit\conda_envs\geo_p310\python.exe for interpreter e:\max_schmit\conda_envs\geo_p310\python.exe (KernelSpec file e:\max_schmit\conda_envs\geo_p310\share\jupyter\kernels\python3\kernel.json)
13:00:49.439 [trace] Hiding default KernelSpec d:\conda_envs\geo_p310\python.exe for interpreter d:\conda_envs\geo_p310\python.exe (KernelSpec file d:\conda_envs\geo_p310\share\jupyter\kernels\python3\kernel.json)
13:00:49.441 [trace] Hiding default KernelSpec d:\conda_envs\geo_p312\python.exe for interpreter d:\conda_envs\geo_p312\python.exe (KernelSpec file d:\conda_envs\geo_p312\share\jupyter\kernels\python3\kernel.json)
13:00:49.972 [debug] No interpreter for Pylance for Notebook URI "e:\max_schmit\Projekte\StressRes\scripts\python\notebooks\create_RoGeR_input.ipynb"
13:00:53.156 [trace] Conda file is D:\conda_envs\anaconda-navigator\Scripts\conda.exe
13:01:02.404 [trace] Python API env change detected, remove => 'C:\PROGRAMDATA\SPYDER-6\ENVS\SPYDER-RUNTIME\PYTHON.EXE'
13:01:02.407 [debug] Start refreshing Kernel Picker (1728903662407)
13:01:02.414 [trace] Python API env change detected, remove => 'C:\PROGRAMDATA\SPYDER-6\PYTHON.EXE'
13:01:02.423 [trace] Python API env change detected, update => 'C:\PROGRAM FILES\PYTHON310\PYTHON.EXE'
13:01:02.434 [trace] Python API env change detected, update => 'D:\CONDA_ENVS\ROGER_ALL_P310\PYTHON.EXE'
13:01:02.443 [trace] Python API env change detected, update => 'C:\CONDA\PYTHON.EXE'
13:01:02.455 [trace] Python API env change detected, update => 'D:\CONDA_ENVS\ANACONDA-NAVIGATOR\PYTHON.EXE'
13:01:02.464 [trace] Python API env change detected, update => 'D:\CONDA_ENVS\GEO_P310\PYTHON.EXE'
13:01:02.475 [trace] Python API env change detected, update => 'D:\CONDA_ENVS\GEO_P312\PYTHON.EXE'
13:01:02.483 [trace] Python API env change detected, update => 'D:\CONDA_ENVS\GEO_P38\PYTHON.EXE'
13:01:02.495 [trace] Python API env change detected, update => 'D:\CONDA_ENVS\QGIS\PYTHON.EXE'
13:01:02.503 [trace] Python API env change detected, update => 'E:\MAX_SCHMIT\PY_VENV\GEO_P310\SCRIPTS\PYTHON.EXE'
13:01:02.512 [trace] Python API env change detected, update => 'E:\MAX_SCHMIT\CONDA_ENVS\GEO_P310\PYTHON.EXE'
13:01:02.522 [trace] Python API env change detected, update => 'E:\MAX_SCHMIT\CONDA_ENVS\GEO_P38\PYTHON.EXE'
13:01:02.531 [trace] Python API env change detected, update => 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\SHARED\PYTHON37_64\PYTHON.EXE'
13:01:02.602 [error] Failure in listKernelsImplementation [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Microsoft VS Code\~'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'mkdir',
  path: 'C:\\Program Files\\Microsoft VS Code\\~'
}
13:01:02.604 [error] Failure in listKernelsImplementation [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Microsoft VS Code\~'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'mkdir',
  path: 'C:\\Program Files\\Microsoft VS Code\\~'
}
13:01:02.605 [debug] End refreshing Kernel Picker (1728903662407)
13:01:02.826 [trace] Python API env change detected, add => 'C:\PROGRAMDATA\SPYDER-6\PYTHON.EXE'
13:01:02.829 [debug] Start refreshing Kernel Picker (1728903662829)
13:01:02.837 [error] Failure in listKernelsImplementation [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Microsoft VS Code\~'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'mkdir',
  path: 'C:\\Program Files\\Microsoft VS Code\\~'
}
13:01:02.838 [error] Failure in listKernelsImplementation [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Microsoft VS Code\~'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'mkdir',
  path: 'C:\\Program Files\\Microsoft VS Code\\~'
}
13:01:02.838 [debug] End refreshing Kernel Picker (1728903662829)
13:01:02.847 [trace] Python API env change detected, add => 'C:\PROGRAMDATA\SPYDER-6\ENVS\SPYDER-RUNTIME\PYTHON.EXE'
13:01:02.850 [debug] Start refreshing Kernel Picker (1728903662850)
13:01:02.859 [error] Failure in listKernelsImplementation [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Microsoft VS Code\~'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'mkdir',
  path: 'C:\\Program Files\\Microsoft VS Code\\~'
}
13:01:02.860 [error] Failure in listKernelsImplementation [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Microsoft VS Code\~'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'mkdir',
  path: 'C:\\Program Files\\Microsoft VS Code\\~'
}
13:01:02.860 [debug] End refreshing Kernel Picker (1728903662850)
13:01:02.911 [warn] No interpreter with path D:\conda_envs\geo_p312\python.exe found in Python API, will convert Uri path to string as Id D:\conda_envs\geo_p312\python.exe
13:01:02.914 [debug] Start refreshing Kernel Picker (1728903662914)
13:01:02.915 [error] Failure in listKernelsImplementation [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Microsoft VS Code\~'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'mkdir',
  path: 'C:\\Program Files\\Microsoft VS Code\\~'
}
13:01:02.916 [debug] End refreshing Kernel Picker (1728903662914)

@maxschmi Thank you for the logs, will work on a fix shortly.
Unfortunately the fix will only be in the pre-release version for now, and will go out in the next stable release, early Nov

@maxschmi Please can you try this in the latest pre-release version of the Jupyter extensxion.
FYI, you'll need to install this in the latest VS Code Insiders version (not stable).

@DonJayamanne OKay I did Install the newest VS Code Insiders Release and there it works fine. Thanks for the fix

Thank you for getting back with the confirmation.