notebook: Restarted computer, can no longer reach kernel

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:

    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?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 28
  • Comments: 34

Most upvoted comments

Commands if you installed with pip3:

pip3 uninstall tornado
pip3 install tornado==5.1.1

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

This did not work for me… I did get this instead: ImportError: The Jupyter Server requires tornado >=6.1.0

Does anybody know why? jupyterlab-server==2.5.2 btw

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?

Worked for me, 1 year later!

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.

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.