问题
I got the following problem. After update Anaconda because I got an error to import skimage.io to a project in Jupyter Notebook an even a greater error appear - Dead Kernel. Right now I could not ever start a project because the Jupyter gives the following error is:
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?
token=aaf85a5e18489792c87cce65d7a53a0263cd5c08cc7248b 6
[I 00:55:13.451 NotebookApp] Accepting one-time-token-authenticated
connection from ::1
[I 00:55:31.607 NotebookApp] Kernel started: 608d2190-59e6-4888-b09a-
e616f67bd5b4
Traceback (most recent call last):
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-
packages\zmq\eventloop\zmqstream.py", line 432, in _run_callback
callback(*args, **kwargs)
File "C:\Program Files\Anaconda3\lib\site-
packages\tornado\stack_context.py", line 276, in null_wrapper
return fn(*args, **kwargs)
File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py",
line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py",
line 233, in dispatch_shell
self.pre_handler_hook()
File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py",
line 248, in pre_handler_hook
self.saved_sigint_handler = signal(SIGINT, default_int_handler)
File "C:\Program Files\Anaconda3\lib\signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread File "C:\Program
Files\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Program Files\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel_launcher.py",
line 16, in <module>
app.launch_new_instance()
File "C:\Program Files\Anaconda3\lib\site-
packages\traitlets\config\application.py", line 658, in launch_instance
app.start()
File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelapp.py",
line 477, in start
ioloop.IOLoop.instance().start()
File "C:\Program Files\Anaconda3\lib\site-
packages\tornado\platform\asyncio.py", line 112, in start
self.asyncio_loop.run_forever()
ERROR:tornado.general:Uncaught exception in zmqstream callback
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-
packages\zmq\eventloop\zmqstream.py", line 450, in _handle_events
self._handle_recv()
File "C:\Program Files\Anaconda3\lib\site-
packages\zmq\eventloop\zmqstream.py", line 480, in _handle_recv
self._run_callback(callback, msg)
File "C:\Program Files\Anaconda3\lib\site-
packages\zmq\eventloop\zmqstream.py", line 432, in _run_callback
callback(*args, **kwargs)
File "C:\Program Files\Anaconda3\lib\site-
packages\tornado\stack_context.py", line 276, in null_wrapper
return fn(*args, **kwargs)
File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py",
line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py",
line 233, in dispatch_shell
self.pre_handler_hook()
File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py",
line 248, in pre_handler_hook
self.saved_sigint_handler = signal(SIGINT, default_int_handler)
File "C:\Program Files\Anaconda3\lib\signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread File "C:\Program
Files\Anaconda3\lib\asyncio\base_events.py", line 409, in run_forever
回答1:
The following packages are required for a brand new installation of jupyter notebook (version 5.6) with conda
, so the working version of tornado
is 5.1.
ipykernel: 4.8.2-py36_0 conda-forge
ipywidgets: 7.4.0-py_0 conda-forge
jupyter: 1.0.0-py_1 conda-forge
jupyter_client: 5.2.3-py_1 conda-forge
jupyter_console: 5.2.0-py36_0 conda-forge
nbconvert: 5.3.1-py_1 conda-forge
notebook: 5.6.0-py36_0 conda-forge
qtconsole: 4.3.1-py36_0 conda-forge
terminado: 0.8.1-py36_0 conda-forge
tornado: 5.1-py36h470a237_1 conda-forge
widgetsnbextension: 3.4.0-py36_0 conda-forge
To fix this problem, one can manually install the newest version of tornado
:
conda install tornado --update
or re-install jupyter notebook from scratch:
conda uninstall jupyter tornado
conda install jupyter
回答2:
After trying a lot of "quick fixes" - uninstall and install Jupyter packages and etc., the only way was to uninstall and install Anaconda from the beginning. If you are not afraid to install all the packages from scratch (in my case was not necessary) this solution is the best.
回答3:
I think the problem here is because of tornado version mismatch. You should just downgrade to older version of tornado to solve the issue. At least, that's what worked for me. This should do the trick.
conda install tornado=4.5.3
回答4:
Upgrading ipykernel worked for me
conda upgrade ipykernel
回答5:
I too faced to problem when l was using my Jupyter lab, l upgraded the version with the command.
pip install jupyterlab —upgrade
To avoid a system wide installation pip install jupyterlab —upgrade —user
来源:https://stackoverflow.com/questions/49603097/jupyter-notebook-dead-kernel-after-anaconda-update