I start with a working jupyter setup, and everything works just fine. I can interrupt or restart the kernel from the notebook without any problems.
If, however, I change some jupyter configuration, or install some modules, and restart jupyter server - I have to wait for about 5 minutes for the open notebooks to recover access to the python kernel.
To reproduce the problem:
Start jupyter (local shell)
jupyter notebook
In chrome create a new notebook (python 3), which will result in a url like:
http://localhost:8888/notebooks/Untitled1.ipynb?kernel_name=python3
Create and run a single cell in that new notebook:
print(1)
Restart jupyter (Ctrl-C followed by [yes] to the prompt to exit), followed by:
jupyter notebook
Go to the same chrome tab with the same single cell notebook and click OK for the pop-up
"Connection failed"Observe the notebook showing:
[Connecting to Kernel]without success.Try to Restart the kernel via the menu, usually it gets stuck in
[Kernel Starting...], and after several manually forced kernel restarts it supposedly succeeds[Kernel Created], but it's a false success, as trying to run the cells gives a[*]busy sign and nothing happens.
After some 5 min of waiting it recovers by itself.
Workarounds:
- Reloading the notebook in the browser (i.e. hitting Reload at the browser level)
- Restarting chrome
Software:
- ubuntu 16.04
- notebook 5.5.0
- python 3.6.6
- chrome 67
- no adblock software enabled
- empty ~/.jupyter (removed everything for the sake of the testing, so no extensions or custom configuration)
Same setup works fine in firefox on the same machine.
There are several tickets on github about the same from 2015 (e.g. this, but somehow they blame it on chrome and clearly the issue is still there 3 years later.
Any idea how to solve this?
Thank you.
And here is the log during the open notebook reconnect/restart process:
[I 22:54:09.032 NotebookApp] Kernel restarted: 9aa08efb-74b1-471c-ad0f-bb9dc3577c28 [W 22:54:09.343 NotebookApp] Replacing stale connection: 6cc8a446-1dc0-4c01-86ab-f95ae99c24af:10a12a1b834f43298fb9e6f344bc6b26 [W 22:54:45.348 NotebookApp] Replacing stale connection: 6cc8a446-1dc0-4c01-86ab-f95ae99c24af:10a12a1b834f43298fb9e6f344bc6b26 [W 22:55:37.359 NotebookApp] Replacing stale connection: 6cc8a446-1dc0-4c01-86ab-f95ae99c24af:10a12a1b834f43298fb9e6f344bc6b26 [W 22:57:01.367 NotebookApp] Replacing stale connection: 6cc8a446-1dc0-4c01-86ab-f95ae99c24af:10a12a1b834f43298fb9e6f344bc6b26 [I 22:57:41.337 NotebookApp] Adapting to protocol v5.1 for kernel 9aa08efb-74b1-471c-ad0f-bb9dc3577c28 [W 22:57:41.350 NotebookApp] Replacing stale connection: 9aa08efb-74b1-471c-ad0f-bb9dc3577c28:768880fb9a244da99735e983bd6c36c6 [I 22:57:41.351 NotebookApp] Starting buffering for 9aa08efb-74b1-471c-ad0f-bb9dc3577c28:768880fb9a244da99735e983bd6c36c6 [I 22:57:41.351 NotebookApp] Adapting to protocol v5.1 for kernel 9aa08efb-74b1-471c-ad0f-bb9dc3577c28 [I 22:57:41.352 NotebookApp] Restoring connection for 9aa08efb-74b1-471c-ad0f-bb9dc3577c28:768880fb9a244da99735e983bd6c36c6 [I 22:57:49.324 NotebookApp] Starting buffering for 9aa08efb-74b1-471c-ad0f-bb9dc3577c28:768880fb9a244da99735e983bd6c36c6 [I 22:57:49.327 NotebookApp] Adapting to protocol v5.1 for kernel 9aa08efb-74b1-471c-ad0f-bb9dc3577c28 [I 22:57:49.328 NotebookApp] Restoring connection for 9aa08efb-74b1-471c-ad0f-bb9dc3577c28:768880fb9a244da99735e983bd6c36c6