question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jupyter kernel started crashing

See original GitHub issue

Applies To

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

What happened?

The Kernel crashed while executing code in the the current cell or a previous cell. Please review the code in the cell(s) to identify a possible cause of the failure. Click here for more info. View Jupyter log for further details.

Canceled future for execute_request message before replies were done

I have a code cell I’ve run successfully in the past that started bringing the whole server down recently. I think it may have started after upgrading some packages in my venv. Tried downgrading those again which didn’t help.

VS Code Version

1.72.2

Jupyter Extension Version

2022.9.1202862440

Jupyter logs

[I 16:40:12.337 NotebookApp] Creating new notebook in /data/wbm/2022-10-13
[I 16:40:12.339 NotebookApp] Saving Untitled.ipynb
info 16:40:12.347: installMissingDependencies /Users/janosh/.venv/py310/bin/python, ui.disabled=false for resource '/Users/janosh/dev/matbench-discovery/data/wbm/2022-10-13/get-ppd-mp-stabilities.py'
info 16:40:12.349: Got env vars with python /Users/janosh/.venv/py310/bin/python, with env var count 47 and custom env var count 0 in 1ms
info 16:40:12.349: Got env vars ourselves faster /Users/janosh/.venv/py310/bin/python with env var count 46 in 1ms
info 16:40:12.349: Process Execution: > ~/.venv/py310/bin/python -c "import ipykernel"
> ~/.venv/py310/bin/python -c "import ipykernel"
info 16:40:12.487: Spec argv[0] updated from '/Users/janosh/.venv/py310/bin/python' to '/Users/janosh/.venv/py310/bin/python'
info 16:40:12.487: Got env vars with python /Users/janosh/.venv/py310/bin/python, with env var count 47 and custom env var count 0 in 0ms
info 16:40:12.487: Got env vars ourselves faster /Users/janosh/.venv/py310/bin/python with env var count 46 in 0ms
[I 16:40:12.510 NotebookApp] Kernel started: 310beb35-d16d-4ca5-a923-9abc44016165, name: python3106jvsc74a57bd08022b3e932e045c760cb4633b91dd1cb8bc60d104ca9808334cbd1645adbe837
[W 16:40:12.518 NotebookApp] delete /data/wbm/2022-10-13/get-ppd-mp-stabilities.py-jvsc-4073c550-2bd7-4839-94d4-a0448b7b7109d13e587a-5aa9-4a9e-99a5-9ef9bb5c4713.ipynb
info 16:40:12.602: Got env vars with python /Users/janosh/.venv/py310/bin/python, with env var count 47 and custom env var count 0 in 0ms
info 16:40:12.602: Got env vars ourselves faster /Users/janosh/.venv/py310/bin/python with env var count 46 in 0ms
info 16:40:12.978: Started session for kernel startUsingPythonInterpreter:.jvsc74a57bd08022b3e932e045c760cb4633b91dd1cb8bc60d104ca9808334cbd1645adbe837./Users/janosh/.venv/py310/python./Users/janosh/.venv/py310/python.-m#ipykernel_launcher
info 16:40:12.980: UpdateWorkingDirectoryAndPath in Kernel
info 16:40:13.084: Generated code for 1 = <ipython-input-1-686d59e8522a> with 20 lines
info 16:40:14.599: Generated code for 2 = <ipython-input-2-ed09f49fb273> with 19 lines
info 16:40:28.731: Interrupt requested /Users/janosh/dev/matbench-discovery/data/wbm/2022-10-13/get-ppd-mp-stabilities.py
info 16:40:28.731: Interrupt requested & sent for Interactive-2.interactive in notebookEditor.
info 16:40:28.731: Interrupt kernel execution
info 16:40:28.731: Interrupt kernel execution
info 16:40:28.731: Interrupting kernel: python3106jvsc74a57bd08022b3e932e045c760cb4633b91dd1cb8bc60d104ca9808334cbd1645adbe837
[I 16:40:28.734 NotebookApp] Kernel interrupted: 310beb35-d16d-4ca5-a923-9abc44016165
info 16:40:29.332: Cancel all remaining cells true || Error || undefined
info 16:40:32.286: Process Execution: > ~/.venv/py310/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/pythonFiles/normalizeSelection.py
> ~/.venv/py310/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/pythonFiles/normalizeSelection.py
info 16:40:32.349: Generated code for 3 = <ipython-input-3-6a472a48d249> with 1 lines
info 16:40:34.758: Generated code for 4 = <ipython-input-4-7d14fe430f41> with 6 lines
[I 16:40:39.500 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
error 16:40:39.508: Error in waiting for cell to complete Error: Canceled future for execute_request message before replies were done
    at a.KernelShellFutureHandler.dispose (/Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:32353)
    at /Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:26572
    at Map.forEach (<anonymous>)
    at y._clearKernelState (/Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:26557)
    at /Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:29000
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
warn 16:40:39.508: Cell completed with errors {
  message: 'Canceled future for execute_request message before replies were done'
}
info 16:40:39.508: Cancel all remaining cells true || Error || undefined
[I 16:40:39.508 NotebookApp] Starting buffering for 310beb35-d16d-4ca5-a923-9abc44016165:fb7ba576-f786-4ef5-9bcd-646dd43f3772
[I 16:40:39.525 NotebookApp] Restoring connection for 310beb35-d16d-4ca5-a923-9abc44016165:fb7ba576-f786-4ef5-9bcd-646dd43f3772
info 16:43:16.079: Disposing kernel .jvsc74a57bd08022b3e932e045c760cb4633b91dd1cb8bc60d104ca9808334cbd1645adbe837./Users/janosh/.venv/py310/python./Users/janosh/.venv/py310/python.-m#ipykernel_launcher for notebook Interactive-2.interactive due to selection of another kernel or closing of the notebook
info 16:43:16.079: Dispose Kernel 'Interactive-2.interactive' associated with '/Users/janosh/dev/matbench-discovery/data/wbm/2022-10-13/get-ppd-mp-stabilities.py'
info 16:43:16.084: Dispose Kernel 'Interactive-2.interactive' associated with '/Users/janosh/dev/matbench-discovery/data/wbm/2022-10-13/get-ppd-mp-stabilities.py'
[I 16:43:16.092 NotebookApp] Kernel shutdown: 310beb35-d16d-4ca5-a923-9abc44016165
info 16:43:18.378: Starting interactive window for resource '/Users/janosh/dev/matbench-discovery/data/wbm/2022-10-13/get-ppd-mp-stabilities.py'
info 16:43:18.431: Attempting to start a server because of preload conditions ...
info 16:43:18.432: Preferred Remote kernel for Interactive-2.interactive is undefined
info 16:43:18.610: Starting Jupyter Session startUsingPythonInterpreter, .jvsc74a57bd08022b3e932e045c760cb4633b91dd1cb8bc60d104ca9808334cbd1645adbe837./Users/janosh/.venv/py310/python./Users/janosh/.venv/py310/python.-m#ipykernel_launcher (Python Path: /Users/janosh/.venv/py310, EnvType: Venv, EnvName: 'py310', Version: 3.10.6) for 'Interactive-2.interactive' (disableUI=false)
[I 16:43:18.618 NotebookApp] Creating new notebook in /data/wbm/2022-10-13
[I 16:43:18.622 NotebookApp] Saving Untitled.ipynb
info 16:43:18.634: installMissingDependencies /Users/janosh/.venv/py310/bin/python, ui.disabled=false for resource '/Users/janosh/dev/matbench-discovery/data/wbm/2022-10-13/get-ppd-mp-stabilities.py'
info 16:43:18.635: Got env vars with python /Users/janosh/.venv/py310/bin/python, with env var count 47 and custom env var count 0 in 1ms
info 16:43:18.635: Got env vars ourselves faster /Users/janosh/.venv/py310/bin/python with env var count 46 in 1ms
info 16:43:18.635: Process Execution: > ~/.venv/py310/bin/python -c "import ipykernel"
> ~/.venv/py310/bin/python -c "import ipykernel"
info 16:43:18.801: Spec argv[0] updated from '/Users/janosh/.venv/py310/bin/python' to '/Users/janosh/.venv/py310/bin/python'
info 16:43:18.802: Got env vars with python /Users/janosh/.venv/py310/bin/python, with env var count 47 and custom env var count 0 in 1ms
info 16:43:18.802: Got env vars ourselves faster /Users/janosh/.venv/py310/bin/python with env var count 46 in 1ms
[I 16:43:18.826 NotebookApp] Kernel started: 2f6284de-54ae-40a0-9c20-2c2654676244, name: python3106jvsc74a57bd08022b3e932e045c760cb4633b91dd1cb8bc60d104ca9808334cbd1645adbe837
[W 16:43:18.834 NotebookApp] delete /data/wbm/2022-10-13/get-ppd-mp-stabilities.py-jvsc-c3f5fa42-5131-46d7-9fb3-5f0b4fd19cd38c4d3ab2-a8d6-49e0-b076-7d2e07429436.ipynb
info 16:43:18.933: Got env vars with python /Users/janosh/.venv/py310/bin/python, with env var count 47 and custom env var count 0 in 1ms
info 16:43:18.933: Got env vars ourselves faster /Users/janosh/.venv/py310/bin/python with env var count 46 in 1ms
info 16:43:19.390: Started session for kernel startUsingPythonInterpreter:.jvsc74a57bd08022b3e932e045c760cb4633b91dd1cb8bc60d104ca9808334cbd1645adbe837./Users/janosh/.venv/py310/python./Users/janosh/.venv/py310/python.-m#ipykernel_launcher
info 16:43:19.391: UpdateWorkingDirectoryAndPath in Kernel
info 16:43:19.492: Generated code for 1 = <ipython-input-1-686d59e8522a> with 20 lines
info 16:43:20.680: Generated code for 2 = <ipython-input-2-be806d201031> with 20 lines
info 16:43:32.231: Generated code for 3 = <ipython-input-3-7d14fe430f41> with 6 lines
[I 16:43:36.820 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
error 16:43:36.825: Error in waiting for cell to complete Error: Canceled future for execute_request message before replies were done
    at a.KernelShellFutureHandler.dispose (/Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:32353)
    at /Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:26572
    at Map.forEach (<anonymous>)
    at y._clearKernelState (/Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:26557)
    at /Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:29000
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
warn 16:43:36.825: Cell completed with errors {
  message: 'Canceled future for execute_request message before replies were done'
}
info 16:43:36.826: Cancel all remaining cells true || Error || undefined
[I 16:43:36.825 NotebookApp] Starting buffering for 2f6284de-54ae-40a0-9c20-2c2654676244:20006cc3-ff15-4b48-9faf-d024f0caab14
[I 16:43:36.834 NotebookApp] Restoring connection for 2f6284de-54ae-40a0-9c20-2c2654676244:20006cc3-ff15-4b48-9faf-d024f0caab14
info 16:44:02.465: Disposing kernel .jvsc74a57bd08022b3e932e045c760cb4633b91dd1cb8bc60d104ca9808334cbd1645adbe837./Users/janosh/.venv/py310/python./Users/janosh/.venv/py310/python.-m#ipykernel_launcher for notebook Interactive-2.interactive due to selection of another kernel or closing of the notebook
info 16:44:02.465: Dispose Kernel 'Interactive-2.interactive' associated with '/Users/janosh/dev/matbench-discovery/data/wbm/2022-10-13/get-ppd-mp-stabilities.py'
info 16:44:02.470: Dispose Kernel 'Interactive-2.interactive' associated with '/Users/janosh/dev/matbench-discovery/data/wbm/2022-10-13/get-ppd-mp-stabilities.py'
[I 16:44:02.484 NotebookApp] Kernel shutdown: 2f6284de-54ae-40a0-9c20-2c2654676244
info 16:44:03.974: Starting interactive window for resource '/Users/janosh/dev/matbench-discovery/data/wbm/2022-10-13/get-ppd-mp-stabilities.py'
info 16:44:04.026: Attempting to start a server because of preload conditions ...
info 16:44:04.027: Preferred Remote kernel for Interactive-2.interactive is undefined
info 16:44:04.201: Starting Jupyter Session startUsingPythonInterpreter, .jvsc74a57bd08022b3e932e045c760cb4633b91dd1cb8bc60d104ca9808334cbd1645adbe837./Users/janosh/.venv/py310/python./Users/janosh/.venv/py310/python.-m#ipykernel_launcher (Python Path: /Users/janosh/.venv/py310, EnvType: Venv, EnvName: 'py310', Version: 3.10.6) for 'Interactive-2.interactive' (disableUI=false)
[I 16:44:04.208 NotebookApp] Creating new notebook in /data/wbm/2022-10-13
[I 16:44:04.210 NotebookApp] Saving Untitled.ipynb
info 16:44:04.222: installMissingDependencies /Users/janosh/.venv/py310/bin/python, ui.disabled=false for resource '/Users/janosh/dev/matbench-discovery/data/wbm/2022-10-13/get-ppd-mp-stabilities.py'
info 16:44:04.223: Got env vars ourselves faster /Users/janosh/.venv/py310/bin/python with env var count 46 in 0ms
info 16:44:04.224: Process Execution: > ~/.venv/py310/bin/python -c "import ipykernel"
> ~/.venv/py310/bin/python -c "import ipykernel"
info 16:44:04.329: Got env vars with python /Users/janosh/.venv/py310/bin/python, with env var count 47 and custom env var count 0 in 106ms
info 16:44:04.371: Spec argv[0] updated from '/Users/janosh/.venv/py310/bin/python' to '/Users/janosh/.venv/py310/bin/python'
info 16:44:04.372: Got env vars ourselves faster /Users/janosh/.venv/py310/bin/python with env var count 46 in 1ms
[I 16:44:04.397 NotebookApp] Kernel started: 1c0ab3ac-e385-4877-8122-af130a8bbb9f, name: python3106jvsc74a57bd08022b3e932e045c760cb4633b91dd1cb8bc60d104ca9808334cbd1645adbe837
[W 16:44:04.407 NotebookApp] delete /data/wbm/2022-10-13/get-ppd-mp-stabilities.py-jvsc-2ab4bf8c-b9a0-450d-ae61-f21f9a2ea24173a59c11-1598-49ba-86f3-f07b5c0d6c31.ipynb
info 16:44:04.413: Got env vars with python /Users/janosh/.venv/py310/bin/python, with env var count 47 and custom env var count 0 in 42ms
info 16:44:04.526: Got env vars with python /Users/janosh/.venv/py310/bin/python, with env var count 47 and custom env var count 0 in 0ms
info 16:44:04.526: Got env vars ourselves faster /Users/janosh/.venv/py310/bin/python with env var count 46 in 0ms
info 16:44:05.020: Started session for kernel startUsingPythonInterpreter:.jvsc74a57bd08022b3e932e045c760cb4633b91dd1cb8bc60d104ca9808334cbd1645adbe837./Users/janosh/.venv/py310/python./Users/janosh/.venv/py310/python.-m#ipykernel_launcher
info 16:44:05.021: UpdateWorkingDirectoryAndPath in Kernel
info 16:44:05.134: Generated code for 1 = <ipython-input-1-686d59e8522a> with 20 lines
info 16:44:06.259: Generated code for 2 = <ipython-input-2-be806d201031> with 20 lines
info 16:44:18.356: Generated code for 3 = <ipython-input-3-7d14fe430f41> with 6 lines
error 16:44:22.398: Error in waiting for cell to complete Error: Canceled future for execute_request message before replies were done
    at a.KernelShellFutureHandler.dispose (/Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:32353)
    at /Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:26572
    at Map.forEach (<anonymous>)
    at y._clearKernelState (/Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:26557)
    at /Users/janosh/.vscode/extensions/ms-toolsai.jupyter-2022.9.1202862440/out/node_modules/@jupyterlab/services.js:2:29000
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
warn 16:44:22.399: Cell completed with errors {
  message: 'Canceled future for execute_request message before replies were done'
}
info 16:44:22.400: Cancel all remaining cells true || Error || undefined
[I 16:44:22.385 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
[I 16:44:22.401 NotebookApp] Starting buffering for 1c0ab3ac-e385-4877-8122-af130a8bbb9f:75f86d89-4574-4565-ab7c-5cb949edbe79
[I 16:44:22.415 NotebookApp] Restoring connection for 1c0ab3ac-e385-4877-8122-af130a8bbb9f:75f86d89-4574-4565-ab7c-5cb949edbe79

Coding Language and Runtime Version

Python 3.10

Language Extension Version (if applicable)

No response

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

Local

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
janoshcommented, Oct 26, 2022

I can repro the same kernel crash even outside VS Code, i.e. if you run the same code in Jupyter Notebooks the kernel crashes.

Should have tried that myself. 🤦

Just to check, do you have any advice how to debug this? Is there some hidden stack trace somewhere?

1reaction
DonJayamannecommented, Oct 26, 2022

Great thanks, I’m on a M1 as well and can repro this same issue, will look into this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kernel Crashes with · Issue #9741 · microsoft/vscode-jupyter
The main error looks like it's happening on the Jupyter server side. In general that might not be something that we can help...
Read more >
Why does jupyter notebook server keeps crashing when ...
Check which version of pyzmq is installed. If Jupyter Notebook and the kernel are in different conda envs, check both and make sure...
Read more >
How to reset a Jupyter notebook(to resolve kernel crashes)
Solution · TLDR: Run /dsa/scripts/nbclean.py with the path to the offending notebook to clear all code cell outputs when you cause your jupyter ......
Read more >
Jupyter lab kernel crashes repeatedly
I am trying to do sentiment analysis and when I import transformers the kernel crashes. Now, if I run any analysis, the kernel...
Read more >
Constant crashing while working with Jupyter notebooks
I'm experiencing the same issues, since the beginning of the new notebook interface. Currently using 2020.1 release at the moment.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found