AttributeError:'MappingKernelManager' 对象没有属性 'connect_control'

AttributeError:'MappingKernelManager' 对象没有属性 'connect_control'

我最近将 Anaconda 3 环境从 2019.03 升级到 2019.07,并开始遇到连接到运行良好的 jupyter 笔记本内核的问题。我运行的是 Windows 10 1903,Edge 和 Chrome 浏览器(版本 76.0.3809.100)也存在同样的问题

我打开 Anaconda 提示符,输入“Jupyter 笔记本”,然后从浏览器连接到提供的 URL。此后,当我尝试打开现有笔记本或创建新笔记本时,我得到了第一个框,但左上角有一个标志,显示“连接到内核”,什么也没发生(我无法运行 Python 内容)。命令提示符显示以下内容:

[W 18:39:19.693 NotebookApp] Replacing stale connection: 52cdf5d1-ecc7-4eb6-be3e-5f2721563f71:1cb0e9060a9043cf81d90bcdc66e92df
[I 18:39:45.715 NotebookApp] Starting buffering for 52cdf5d1-ecc7-4eb6-be3e-5f2721563f71:1cb0e9060a9043cf81d90bcdc66e92df
[I 18:39:50.589 NotebookApp] Creating new notebook in
[W 18:39:50.890 NotebookApp] 404 GET /static/components/react/react-dom.production.min.js (::1) 15.63ms referer=http://localhost:8888/notebooks/Untitled8.ipynb?kernel_name=python3
[I 18:39:51.332 NotebookApp] Kernel started: 1593c869-7614-4652-8a2a-c146de11d100
[I 18:39:52.517 NotebookApp] Adapting from protocol version 5.1 (kernel 1593c869-7614-4652-8a2a-c146de11d100) to 5.3 (client).
[E 18:39:52.526 NotebookApp] Uncaught exception GET /api/kernels/1593c869-7614-4652-8a2a-c146de11d100/channels?session_id=35ad854ba53946b583300b9953a75cbf (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/kernels/1593c869-7614-4652-8a2a-c146de11d100/channels?session_id=35ad854ba53946b583300b9953a75cbf', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "C:\Users\MuratCudiErentürk\AppData\Roaming\Python\Python37\site-packages\tornado\websocket.py", line 956, in _accept_connection
        open_result = handler.open(*handler.open_args, **handler.open_kwargs)
      File "C:\tools\Anaconda3\lib\site-packages\notebook\services\kernels\handlers.py", line 274, in open
        self.create_stream()
      File "C:\tools\Anaconda3\lib\site-packages\notebook\services\kernels\handlers.py", line 127, in create_stream
        meth = getattr(km, 'connect_' + channel)
    AttributeError: 'MappingKernelManager' object has no attribute 'connect_control'
[W 18:39:53.550 NotebookApp] Replacing stale connection: 1593c869-7614-4652-8a2a-c146de11d100:35ad854ba53946b583300b9953a75cbf
[I 18:41:51.338 NotebookApp] Saving file at /Untitled8.ipynb

答案1

我在使用 jupyter-client==5.2.4 和 jupyter-core==4.4.0 时遇到了同样的错误。然后我升级到 jupyter-client==5.3.1 和 jupyter-core==4.5.0,问题就解决了。您可以尝试升级这两个软件包,看看是否能解决问题。

我没有在这个系统上使用 Anaconda,但我认为这应该可行:

conda update jupyter-client jupyter-core

如果没有,你可以尝试:

pip install --upgrade jupyter-client jupyter-core

相关内容