'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?
Solution 1:[1]
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.
Solution 2:[2]
If you have been training a large neural network for a long time and then this has happened, you should just wait till the time you expect the process to finish.
Screenshot of the same happening to me
In this image, you can clearly see that the output is frozen on 3rd epoch but the weights have been saved till 14th epoch and the program is still running.
Solution 3:[3]
I am facing the same problem recently, that jupyter notebook often stucks without any reason, even when executing very simple code (such as x = 1), so there was no possibility that I fell into an infinite loop.
I noticed that every time this situation occurred, there was a solid circle on the top right of the page which meant the kernel was busy and working, but it was abnormal that the jupyter took over twenty seconds to process the code like x = 1. I need to wait for several minutes to see if the kernel would come back, while sometimes it never come back, so I have to shut down and restart the kernel with losing all of my data. It is weird that although the kernel sometimes takes a long time to come back on itself, there would be literally NO output, instead "ln []" would be shown in front of that block. Besides, since I am using the extension ExecuteTime, so that I am able to see how long it takes jupyter to execute a code block, and when this awful situtation happens, it turns out
executed in 0ms, finished 01:38:14 2022-03-31
I guess it may be raised by problems of memory, because it seems to have higher frequency when I am processing large datasets or may be due to the unknown incompatibility with nbextensions, as references for other people who meet the same issues.
Solution 4:[4]
I use Jupyter Notebook 4.2.3 on OSX El Capitan, so I might not be really helpful, but at least I can try to guess.
[*] basically means that something is going on, so if you are running a script with some complicated computations, you'd better wait a little bit.
To make sure, you may try to use a loading bar that can help you to control the process. A good one is suggested here. Otherwise, you can check out other notebooks with loading bars illustrating any processes by default. Apache Zeppelin should have such feature.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | anantdark |
| Solution 2 | Vedant Kaushik |
| Solution 3 | Tianjian Che |
| Solution 4 |
