问题
My jupyter notebook doesn't start due the dead kernel with following Kernel error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/web.py", line 1512, in _execute
result = yield result
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/gen.py", line 1055, in run
value = future.result()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/gen.py", line 1069, in run
yielded = self.gen.send(value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 67, in post
model = yield gen.maybe_future(sm.get_session(path=path))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 170, in get_session
return self.row_to_model(row)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 209, in row_to_model
raise KeyError
KeyError
回答1:
In my case, the issue originated from having prompt-toolkit
requirement conflict in jupyter-console
and ipython
.
You can use pip check
to make sure whether you have the same problem. If the output is something similar to my output below, you have to fix the broken packages issue.
>>> pip check ipython
ipython 5.0.0 has requirement prompt-toolkit<2.0.0,>=1.0.3, but you'll have prompt-toolkit 2.0.9 which is incompatible.
>>> pip check jupyter-console
jupyter-console 6.0.0 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.15 which is incompatible.
The quick fix is to try the solution originally mentioned here.
pip uninstall prompt-toolkit
pip install prompt-toolkit==1.0.15
pip uninstall jupyter-console
pip install jupyter-console==5.2.0
来源:https://stackoverflow.com/questions/54437305/jupyter-notebook-failed-to-start-the-kernel-due-the-keyerror