Jupyter Notebook无法启动内核

时间:2018-10-29 10:15:47

标签: jupyter-notebook ipython tornado

当我尝试创建Jupyter笔记本时,我是Jupyter笔记本的新手,它无法通过显示以下错误消息来启动内核,我的python版本是3.5.2,而jupyter版本是4.2.0:

Traceback (most recent call last):
  File "/home/andy/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 526, in get
    value = obj._trait_values[self.name]
KeyError: 'loop'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/andy/anaconda3/lib/python3.5/site-packages/notebook/base/handlers.py", line 457, in wrapper
    result = yield gen.maybe_future(method(self, *args, **kwargs))
  File "/home/andy/.local/lib/python3.5/site-packages/tornado/gen.py", line 1133, in run
    value = future.result()
  File "/home/andy/anaconda3/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/home/andy/.local/lib/python3.5/site-packages/tornado/gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "/home/andy/anaconda3/lib/python3.5/site-packages/notebook/services/sessions/handlers.py", line 62, in post
    kernel_id=kernel_id))
  File "/home/andy/.local/lib/python3.5/site-packages/tornado/gen.py", line 1133, in run
    value = future.result()
  File "/home/andy/anaconda3/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/home/andy/.local/lib/python3.5/site-packages/tornado/gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "/home/andy/anaconda3/lib/python3.5/site-packages/notebook/services/sessions/sessionmanager.py", line 79, in create_session
    kernel_name)
  File "/home/andy/.local/lib/python3.5/site-packages/tornado/gen.py", line 1133, in run
    value = future.result()
  File "/home/andy/anaconda3/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/home/andy/.local/lib/python3.5/site-packages/tornado/gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "/home/andy/anaconda3/lib/python3.5/site-packages/notebook/services/sessions/sessionmanager.py", line 92, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "/home/andy/.local/lib/python3.5/site-packages/tornado/gen.py", line 1133, in run
    value = future.result()
  File "/home/andy/anaconda3/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/home/andy/.local/lib/python3.5/site-packages/tornado/gen.py", line 326, in wrapper
    yielded = next(result)
  File "/home/andy/anaconda3/lib/python3.5/site-packages/notebook/services/kernels/kernelmanager.py", line 87, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "/home/andy/anaconda3/lib/python3.5/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "/home/andy/anaconda3/lib/python3.5/site-packages/jupyter_client/manager.py", line 258, in start_kernel
    self.start_restarter()
  File "/home/andy/anaconda3/lib/python3.5/site-packages/jupyter_client/ioloop/manager.py", line 49, in start_restarter
    kernel_manager=self, loop=self.loop,
  File "/home/andy/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 554, in __get__
    return self.get(obj, cls)
  File "/home/andy/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 533, in get
    value = self._validate(obj, dynamic_default())
  File "/home/andy/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 589, in _validate
    value = self.validate(obj, value)
  File "/home/andy/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 1681, in validate
    self.error(obj, value)
  File "/home/andy/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 1528, in error
    raise TraitError(e)
traitlets.traitlets.TraitError: The 'loop' trait of an IOLoopKernelManager instance must be a ZMQIOLoop, but a value of class 'tornado.platform.asyncio.AsyncIOMainLoop' (i.e. <tornado.platform.asyncio.AsyncIOMainLoop object at 0x7f1dd34e8ef0>) was specified.

我还使用以下命令检查了内核:

jupyter kernelspec list

获得以下结果:

Available kernels:
python3    /home/andy/anaconda3/share/jupyter/kernels/python3

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

Jupyter 4.2.0相当老,并且与5.0之前的Tornado版本不兼容。您需要升级到Jupyter的新版本,或者降级到Tornado的旧版本(使用pip,这将是pip install "tornado<5.0"。我不知道conda等效)