jupyter notebook/由于KeyError无法启动内核 [英] jupyter notebook / Failed to start the kernel due the KeyError

查看:1174
本文介绍了jupyter notebook/由于KeyError无法启动内核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的jupyter笔记本由于死机的内核而无法启动,并出现以下内核错误:

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

推荐答案

在我的情况下,此问题源自jupyter-consoleipython中的prompt-toolkit需求冲突.

In my case, the issue originated from having prompt-toolkit requirement conflict in jupyter-console and ipython.

您可以使用pip check来确定是否存在相同的问题.如果输出与下面的输出类似,则必须修复损坏的程序包问题.

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 

这篇关于jupyter notebook/由于KeyError无法启动内核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆