microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.3k stars 294 forks source link

VSCode unable to find or start python jupyter kernels if python extension runs in a separate extension host process #16234

Closed zacps closed 3 days ago

zacps commented 3 days ago

Applies To

What happened?

Copy of #15783 with new information.

Created a new notebook, and attempted to select a kernel and run a cell.

The kernel picker shows no options under Python environments, and running a cell shows:

Failed to start the Kernel. 
View Jupyter [log](command:jupyter.viewOutput) for further details.

This only occurs if the Python extension is set to run in a separate extension host process via extensions.experimental.affinity.

VS Code Version

Version: 1.90.2 Commit: 5437499feb04f7a586f677b155b039bc2b3669eb Date: 2024-06-18T22:33:48.698Z Electron: 29.4.0 ElectronBuildId: 9728852 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Linux x64 6.5.0-41-generic snap

Jupyter Extension Version

v2024.5.0

Jupyter logs

Visual Studio Code (1.90.2, undefined, desktop)
Jupyter Extension Version: 2024.5.0.
Python Extension not installed.
Pylance Extension not installed.
Platform: linux (x64).
Workspace folder ~/REPO_OBSCURED, Home = /home/zac
08:51:50.996 [info] Starting Kernel (Python 3 (ipykernel)) for '~/REPO_OBSCURED/ran_notebooks/testing.ipynb' (disableUI=false)
08:51:51.008 [info] Launching Raw Kernel Python 3 (ipykernel) # python
08:51:51.016 [info] Process Execution: /python -m ipykernel_launcher --f=/home/~/.local/share/jupyter/runtime/kernel-v2-2311178cDwjhvlbJF.json
    > cwd: //home/~/REPO_OBSCURED/ran_notebooks
08:51:51.019 [error] Kernel died Error: spawn python ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn python',
  path: 'python',
  spawnargs: [
    '-m',
    'ipykernel_launcher',
    '--f=/home/~/.local/share/jupyter/runtime/kernel-v2-2311178cDwjhvlbJF.json'
  ]
} 
08:51:51.021 [error] Disposing kernel process due to an error Error: spawn python ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn python',
  path: 'python',
  spawnargs: [
    '-m',
    'ipykernel_launcher',
    '--f=/home/~/.local/share/jupyter/runtime/kernel-v2-2311178cDwjhvlbJF.json'
  ]
}
08:51:51.021 [error] 
08:51:51.029 [error] Failed to connect raw kernel session: Error: The kernel died. Error: ... View Jupyter [log](command:jupyter.viewOutput) for further details.
08:51:51.029 [error] Failed to connect raw kernel session: Error: The kernel died. Error: ... View Jupyter [log](command:jupyter.viewOutput) for further details.
08:51:51.029 [warn] Failed to shutdown kernel, .python3./python./.-m#ipykernel_launcher TypeError: Cannot read properties of undefined (reading 'dispose')
    at DT.shutdown (/home/~/.vscode/extensions/ms-toolsai.jupyter-2024.5.0-linux-x64/dist/extension.node.js:314:13629)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at _T.shutdown (/home/~/.vscode/extensions/ms-toolsai.jupyter-2024.5.0-linux-x64/dist/extension.node.js:314:22107)
08:51:51.031 [warn] Error occurred while trying to start the kernel, options.disableUI=false Error: The kernel died. Error: ... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .python3./python./.-m#ipykernel_launcher
    > at new r (/home/~/.vscode/extensions/ms-toolsai.jupyter-2024.5.0-linux-x64/dist/extension.node.js:108:4480)
    > originalException = Error: spawn python ENOENT
    > stdErr = 
08:51:51.031 [warn] Kernel Error, context = start Error: The kernel died. Error: ... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .python3./python./.-m#ipykernel_launcher
    > at new r (/home/~/.vscode/extensions/ms-toolsai.jupyter-2024.5.0-linux-x64/dist/extension.node.js:108:4480)
    > originalException = Error: spawn python ENOENT
    > stdErr = 
08:51:51.037 [info] Dispose Kernel '~/REPO_OBSCURED/ran_notebooks/testing.ipynb' associated with '~/REPO_OBSCURED/ran_notebooks/testing.ipynb'
08:51:51.038 [error] Error in execution Error: The kernel died. Error: ... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .python3./python./.-m#ipykernel_launcher
    > at new r (/home/~/.vscode/extensions/ms-toolsai.jupyter-2024.5.0-linux-x64/dist/extension.node.js:108:4480)
    > originalException = Error: spawn python ENOENT
    > stdErr = 
08:51:51.038 [error] Error in execution (get message for cell) Error: The kernel died. Error: ... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .python3./python./.-m#ipykernel_launcher
    > at new r (/home/~/.vscode/extensions/ms-toolsai.jupyter-2024.5.0-linux-x64/dist/extension.node.js:108:4480)
    > originalException = Error: spawn python ENOENT
    > stdErr = 
08:52:57.614 [error] Failed to install Python Extension via Kernel Picker command
08:52:57.615 [warn] DataScience Error Error: Failed to install the Python Extension.
    at ab.installPythonExtensionViaKernelPicker (/home/~/.vscode/extensions/ms-toolsai.jupyter-2024.5.0-linux-x64/dist/extension.node.js:314:34577)
    at h (/snap/code/162/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:153:200468)
08:53:40.742 [error] Failed to install Python Extension via Kernel Picker command
08:53:40.743 [warn] DataScience Error Error: Failed to install the Python Extension.
    at ab.installPythonExtensionViaKernelPicker (/home/~/.vscode/extensions/ms-toolsai.jupyter-2024.5.0-linux-x64/dist/extension.node.js:314:34577)
    at h (/snap/code/162/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:153:200468)

Coding Language and Runtime Version

Python 3.10.12

Language Extension Version (if applicable)

v2024.8.1

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

Local

DonJayamanne commented 3 days ago

This only occurs if the Python extension is set to run in a separate extension host process via extensions.experimental.affinity.

This is by design, closing as this is by design. Both need to run in the same extension host process (as the API from one extension is being used in another).