After upgrading to Mac OS X 10.14.3 and restarting my computer, my notebook seems to be unable to reach the kernel - any cell I try to execute hangs with an asterisk forever.
I see this stacktrace my terminal:
```/Users/ricorodriguez/.local/share/virtualenvs/Math-Pm3XCPT4/lib/python3.7/site-packages/ipykernel_launcher.py:15: VisibleDeprecationWarning: zmq.eventloop.minitornado is deprecated in pyzmq 14.0 and will be removed.
Install tornado itself to use zmq with the tornado IOLoop.
from ipykernel import kernelapp as app
[I 00:32:26.337 NotebookApp] Adapting to protocol v5.1 for kernel 5617837b-16a3-4664-8186-ca371d51d698
/Users/ricorodriguez/.local/share/virtualenvs/Math-Pm3XCPT4/lib/python3.7/site-packages/notebook/base/zmqhandlers.py:284: RuntimeWarning: coroutine 'WebSocketHandler.get' was never awaited
super(AuthenticatedZMQStreamHandler, self).get(args, *kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
[W 00:32:27.519 NotebookApp] Replacing stale connection: 5617837b-16a3-4664-8186-ca371d51d698:ed21d4fb96ee4a0889e5ed93b19a627a
```
I've read a couple of things online about the websocket connection occasionally going bad. Do we know what's usually at the root of this?
FWIW this notebook was serving locally and banging on all cylinders perfectly well last night. I literally just updated my computer, restarted and installed jupyterlab (uninstalled it to see if that was the problem, but no dice).
After blowing out my pipenv environment and restarting, the kernel seems to be able to connect again - however I'm getting some strange behavior that wasn't happening before, namely plotly graphs that were working just fine before are not displaying at all.
Nope, back to square one. After reloading some extensions I can see some web socket failures in the browser console...
[Log] Starting WebSockets: – "ws://localhost:8888/api/kernels/9bf6c96a-ff45-4210-a687-1bee11aa1133" (main.min.js, line 37334)
[Error] WebSocket connection to 'ws://localhost:8888/api/kernels/9bf6c96a-ff45-4210-a687-1bee11aa1133/channels?session_id=9424407052da43c082db83bc522afbf0' failed: Unexpected response code: 200
[Log] Kernel: kernel_disconnected (9bf6c96a-ff45-4210-a687-1bee11aa1133) (main.min.js, line 36978)
[Log] WebSocket connection failed: – "ws://localhost:8888/api/kernels/9bf6c96a-ff45-4210-a687-1bee11aa1133" – true (main.min.js, line 37419)
I was having the same issue with installing jupyter on Pipenv. I would get it, with the same error messages, when I tried to install a new package and then it would go away when I synced to the old Pipfile.lock. I think the issue is that I had allow-prerelease turned on (needed for some other packages) and Pipenv was installing tornado 6.0 beta as a dependency. I added a line to my Pipfile to explicitly install tornado 5.1.1 or less (the latest stable release). This seems to have fixed the problem.
I hope that helps!
@wcass77 downgrading to tornado 5.1.1 solved the problem for me. Seems that there is a problem with tornado 6.0
Commands if you installed with pip3:
sudo pip3 uninstall tornado
sudo pip3 install tornado==5.1.1
sudo pip3 uninstall tornado
sudo pip3 install tornado==5.1.1
Thank!
This solved my problem.
What a nightmare this was to solve! Thank you @amacfie! Is there a way to pin the tornado version in this package somehow so that others don't go through this?
Thanks @amacfie for the solution, I had been searching for an hour. Are the owners of this repo actively working on updating the code to support tornado 6, or is there a way to specify to pip that this version needs to be installed instead of the latest?
After a couple of hours toying with firewall rules as generally that's what is suggested with the forever 'connecting to kernel' message, I stumbled in here. Downgrading tornado works for me.
Downgrading tornado from 6.0 to 5.1.1 solved the issue for me, too.
sudo pip3 uninstall tornado
sudo pip3 install tornado==5.1.1
I had this same issue on a fresh install. I thought it was firewall issues or something else. Didn't realize it was due to tornado 6.0.
Thanks for the help.
I can confirm that downgrading works. I had the same issue when using pipenv and installing from a Pipfile that didn't cause issues before.
Just updated Jupyter this AM and ran into this. Downgrading tornado also fixed it for me.
Commands if you installed with pip3:
sudo pip3 uninstall tornado sudo pip3 install tornado==5.1.1
I was having this problem in Ubuntu 18.04 on virtual box. Wasted at least 6 hours trying to reinstall everything again and again. This solution was a lifesaver.
Commands if you installed with pip3:
sudo pip3 uninstall tornado sudo pip3 install tornado==5.1.1
Having the same problem on latest macOS Mojave. This solved it. Thanks.
I got the same problem on Windows10, python 3.7, it could also be solved downgrading tornado. Thanks a lot.
Worked for me - thanks!
worked for me !! thanks man.... i was so confused using jupyter first time in my life and this error was making me pull my hair ! this solved it .
I got the same problem on Windows10, python 3.7, it could also be solved downgrading tornado. Thanks a lot.
Exactly the same for me.
Same issue here. Fedora 28 64 bits and Python 3.6.8
I had to downgrade tornado to 5.1.1 for Jupyter to work again.
Worked for me as well! Changing the pip dependency should be a high priority issue
Downgrading to 5.1.1 fixed my issue. Thanks.
Downgrading to 5.1.1 worked for me.
@wcass77 Downgrading to 5.1.1 worked for me. Thank you
Downgrading also worked for me.
Python 3.7.2, Windows 10 (x86-64)
@mikekaminsky @DCtheTall A fix is on master https://github.com/jupyter/notebook/commit/9035cb1bdd2fe6c8195912f67d232ed77da0f6c0 but not released yet.
Downgrading tornado from 6.0 to 5.1.1 solved the issue for me as well
notebook package has been updated to version 5.7.5 which fixes this issue due to Tornado 6 (see this tweet). Now, you can simply update the jupyter package.
For further details, you can also check this post on Stack Overflow.
notebook package has been updated to version 5.7.5 which fixes this issue due to Tornado 6 (see this tweet). Now, you can simply update the jupyter package.
Confirmed. Jupyter is working on my platform (Fedora 28/Python 3.6.8) with tornado 6.0 and notebook 5.7.5.
Thanks !
Downgrading to 5.0.2 worked for me, too.
Ugh, just ran into this today, upgraded Jlab in my conda base env with conda update -c conda-forge jupyterlab, I suppose tornado 6 was already existing in my env from another package.
Maybe a quick patch assert tornado.version_info[0] == 5 with a nice message would help here in the meantime? Or is it always recommended to install jupyterlab into it's own env?
Most helpful comment
Commands if you installed with pip3: