The kernel appears to have died. It will restart automatically

Hi,
I got the message “The kernel appears to have died. It will restart automatically.” every time when I ran from fastbook import * in jupyter notebook on my laptop. Would someone tell me the reason? thank you.

Your query provides a tiny pinhole view on your issue that makes it difficult to advise. Some info that would help:

  1. What operating system version are you on?
  2. What software versions are you running: python, jupyter, fastai, fastbook?
  3. Which instructions did you use to install the software?
  4. Have you watched the LIve Coding videos?
  5. What other things have you tried that do work?
  6. Your snapshot shows cells with multiple lines, so how do you determine which line is the problem?

Thanks for your help, here are the details.

  1. What operating system version are you on?
    macos monterey.
  2. What software versions are you running: python, jupyter, fastai, fastbook?
    python 3.9, jupyter notebook, fastbook
  3. Which instructions did you use to install the software?
    I installed python3.9 with mambaforge installer first, then installed ipython and jupyterlab. Finally I installed fastbook.
  4. Have you watched the [LIve Coding videos]?
    Yes
  5. What other things have you tried that do work?
    I tried to run from fastai.vision.widgets import * first, then ran from fastbook import *, it was fine, like this

However, if I run from fastbook import * first, the kernel died.

  1. Your snapshot shows cells with multiple lines, so how do you determine which line is the problem?
    I have updated the screenshots as above. I am not sure about the reason.
1 Like

Cool. Now I can share I don’t have a Mac, so might not be much use to you - but the detail should help the next person help. I can only report it works for me on WSL, when running `from fastbook import *’ first per snapshot in your original post.

Thanks for sharing. I tried on Paperspace, there is no problem. I was wondering if it is the operating system issue.

1 Like

Hey @yflab, I wonder if you managed to solve it?
I have the same issue, MacOS M1 13.0.1, Anaconda Python (base) 3.9.12,

  • In Colab everything is fine
  • when I run it locally on Jupiter sever it has the same issue with restarting the kernel.
  • when I run it in VSCode with Jupiter extension I got this error:
[I 22:45:42.138 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
error 22:45:42.144: Error in waiting for cell to complete Error: Canceled future for execute_request message before replies were done
    at a.KernelShellFutureHandler.dispose (/Users/vladislavsorokin/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/out/node_modules/@jupyterlab/services.js:2:32353)
    at /Users/vladislavsorokin/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/out/node_modules/@jupyterlab/services.js:2:26572
    at Map.forEach (<anonymous>)
    at y._clearKernelState (/Users/vladislavsorokin/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/out/node_modules/@jupyterlab/services.js:2:26557)
    at /Users/vladislavsorokin/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/out/node_modules/@jupyterlab/services.js:2:29000
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
warn 22:45:42.144: Cell completed with errors {
  message: 'Canceled future for execute_request message before replies were done'
}
info 22:45:42.144: Cancel all remaining cells true || Error || undefined
[I 22:45:42.157 NotebookApp] Starting buffering for faa9b7be-7318-4862-b42b-25366f85db81:235fc2ed-61f4-4830-9f54-acedbd3e4783
[I 22:45:42.162 NotebookApp] Restoring connection for faa9b7be-7318-4862-b42b-25366f85db81:235fc2ed-61f4-4830-9f54-acedbd3e4783

it seems that I solved it!

Just installed new environment with conda and python 3.10.8, added jupyter meta package and then installed fastbook in terminal (pip install fastbook executed from within the notebook did not install the package for some reason saying “module not found”)

That’s great! When I had a similar error last time, I just reinstall the base environment following fast.ai live coding session (here is the link: Live coding 1), and then the error disappeared.

For anyone who stuck with this error, probably the first step should be creating a new environment based on environment.yml that is located in the project root folder. I am coming from JS world, where after cloning the repository you do npm i or yarn. In Python projects you use Anaconda and with that package manager you do:

conda env create -f environment.yml
conda activate fastbook # fastbook is the name of the environment you've just created

Surprisingly, executing the first cell that contains pip install fastbook did not work for me, so I did the same command in the terminal (being in the fastbook env) and then everything works flawlessly