On an up to date Fedora, using python3, pip install does not grab the required version of ipykernel, leading notebook to try the system version and fail.
The error below happens upon loading a notebook: the kernel keeps dying and the reload dialogue reappearing.
$ pip install notebook
(...works fine...)
$ jupyter-notebook
[I 22:39:56.149 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[I 22:39:56.332 NotebookApp] Serving notebooks from local directory: /home/eris/Documents/LISIS/projects/esmominer/notebooks
[I 22:39:56.332 NotebookApp] 0 active kernels
[I 22:39:56.332 NotebookApp] The Jupyter Notebook is running at:
[I 22:39:56.332 NotebookApp] http://localhost:8888/?token=14a28c760d7659354355a22f07856d83c3b9a0ea1153cd86
[I 22:39:56.332 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 22:39:56.334 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=14a28c760d7659354355a22f07856d83c3b9a0ea1153cd86
[I 22:39:56.698 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[W 22:48:41.694 NotebookApp] Notebook scanconverter.ipynb is not trusted
[W 22:48:41.760 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20180427223956 (::1) 14.28ms referer=http://localhost:8888/notebooks/scanconverter.ipynb
[I 22:48:42.065 NotebookApp] Kernel started: 09e0cf79-09c2-42a7-905b-5370e22c049a
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/home/eris/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 432, in _run_callback
callback(*args, **kwargs)
File "/home/eris/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 276, in null_wrapper
return fn(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 276, in dispatcher
return self.dispatch_shell(stream, msg)
File "/usr/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 226, in dispatch_shell
self.pre_handler_hook()
File "/usr/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 241, in pre_handler_hook
self.saved_sigint_handler = signal(SIGINT, default_int_handler)
File "/usr/lib64/python3.6/signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread
$ pip install --user --upgrade ipykernel
$ jupyter-notebook
(...works fine...)
That does look like a bug, but it looks like a plain ipykernel bug that must have already been fixed somehow (I don't remember seeing that error reported before).
Hm, what do you mean by already been fixed?
I tried this yesterday. Maybe it is a recent bug?
Or you mean the requirements in PIP now match the expected version and it shouldn't happen anymore?
I mean that I don't think it's some incompatibility that needs a fix in requirements, just a weird bug in ipykernel that you happened to hit, and it (hopefully) went away when you upgraded.
I should have provided this before, but fedora ships ipykernel 4.6.0 and notebook 5.2.1, and these run fine together.
Are you positive that current notebook (5.4.1) runs with ipykernel 4.6.0 ?
If so, I'll close the bug, since it only affects some unfortunate mix of fedora and pip versions.
I'm not positive, but I don't see how that error could be an incompatibility with notebook. Maybe you upgraded some other package at the same time? Maybe jupyter_client, pyzmq or tornado?
Ok, I tried with a clean account, and now I see the error only happens when upgrading both tornado and pyzmq (and nothing else), which I had updated because of bug #3579
$ rm -r .local
$ pip install --user --upgrade notebook tornado pyzmq
$ jupyter-notebook
However, only upgrading pyzmq, and not tornado, works fine.
(Upgrading only tornado leads to bug #3579 )
So this might become an issue if/when updates of tornado become standard.
Hopefully people will upgrade ipykernel as well, one way or another. Thanks for investigating this!
I have had this problem and I think it was due to the references to old site-pages. solstag suggested solution didn't work for me. I resolved this by removing 'ipykernel', 'zmq', and 'tornado' from 'python2.7/site-packages' and then reinstall them.
I had this error after doing an Altair install (pip install -U altair vega_datasets notebook vega), upgrading ipykernel from 4.5.2 to 4.8.2 worked for me.
Most helpful comment
I had this error after doing an Altair install (
pip install -U altair vega_datasets notebook vega), upgrading ipykernel from 4.5.2 to 4.8.2 worked for me.