Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to do when Jupyter suddenly hangs?

I'm using Jupyter notebook 4.0.6 on OSX El Capitan.

Once in a while I'll start running a notebook and the cell will simply hang, with a [ * ] next to it and no output.

When this happens, I find that only killing Jupyter at the command line and restarting it solves the problem. Relaunching the kernel doesn't help.

Has anyone else had this problem? If so, any tips?

like image 376
Richard Avatar asked Oct 09 '16 14:10

Richard


People also ask

Why is my Jupyter notebook stuck?

Try disabling any browser extensions and/or any Jupyter extensions you have installed. Some internet security software can interfere with Jupyter. If you have security software, try turning it off temporarily, and look in the settings for a more long-term solution.

How do you force quit Jupyter?

You can force the termination by deleting the cell. I copy the code, delete the cell, create a new cell, paste, and execute again.

How do I restart Jupyter?

You can restart your Jupyter Kernel by simply clicking Kernel > Restart from the Jupyter menu. Note: This will reset your notebook and remove all variables or methods you've defined! Sometimes you'll notice that your notebook is still hanging after you've restart the kernel. If this occurs try refreshing your browser.


1 Answers

That usually happens when I edit the program after leaving the output running mid-way and then run it again. This will cause the kernel to get struck. I generally just restart the kernel and then it works fine.

To restart the kernel,press Esc to enter command mode, then press 0 0 (zero) to restart the kernel, now your program will run.

To avoid this in the future, remember to complete the execution of your program before editing the code.

like image 101
anantdark Avatar answered Oct 19 '22 22:10

anantdark