C ++ jupyter内核死亡

Posted

技术标签:

【中文标题】C ++ jupyter内核死亡【英文标题】:C++ jupyter kernel death 【发布时间】:2018-01-13 21:10:46 【问题描述】:

当我使用 cling 启动 c++14 jupyter 内核时,我有以下回溯。我从

下载了cling_2018-01-11_mac1012.tar.bz2
https://root.cern.ch/download/cling/

然后将 bin 添加到路径中。为此,我打开了一个终端并输入了

sudo nano /etc/paths

弹出我的密码,然后在文件底部输入下载的二进制文件夹的路径(我通过在文件上点击命令 i 来获取信息),退出并保存缓冲区。使用

测试它是否有效
echo $PATH 

将其添加到路径后,打开一个新终端。 cd进入下载,然后将内核安装在:

/share/cling/Jupyter/kernel

pip install .

jupyter kernelspec install cling-cpp14

然后我从我的桌面打开了一个笔记本,打开了一个 c++14 笔记本,但不幸的是内核死了。这是追溯。任何帮助表示赞赏。

Last login: Sat Jan 13 20:50:16 on ttys000
Air-2:~ $ jupyter notebook
[I 20:52:08.968 NotebookApp] Serving notebooks from local directory: /Users/
[I 20:52:08.968 NotebookApp] 0 active kernels 
[I 20:52:08.968 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=d80248d47c35d5f960dc7206a612940826e425ca9f065740
[I 20:52:08.968 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 20:52:08.971 NotebookApp] 

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=d80248d47c35d5f960dc7206a612940826e425ca9f065740
[I 20:52:09.423 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[I 20:52:17.303 NotebookApp] Creating new notebook in 
[I 20:52:17.752 NotebookApp] Kernel started: 66454176-a4a3-4d56-b1d9-4ef88fa0195d
Traceback (most recent call last):
  File "/Users//anaconda/bin/jupyter-cling-kernel", line 4, in <module>
    main()
  File "/Users//anaconda/lib/python3.6/site-packages/clingkernel.py", line 344, in main
    ClingKernelApp.launch_instance()
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-120>", line 2, in initialize
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users//anaconda/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 454, in initialize
    self.init_kernel()
  File "/Users//anaconda/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 365, in init_kernel
    user_ns=self.user_ns,
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/Users//anaconda/lib/python3.6/site-packages/clingkernel.py", line 101, in __init__
    whichCling = os.readlink(shutil.which('cling'))
TypeError: readlink: path should be string, bytes or os.PathLike, not NoneType
[I 20:52:20.755 NotebookApp] KernelRestarter: restarting kernel (1/5)
Traceback (most recent call last):
  File "/Users//anaconda/bin/jupyter-cling-kernel", line 4, in <module>
    main()
  File "/Users//anaconda/lib/python3.6/site-packages/clingkernel.py", line 344, in main
    ClingKernelApp.launch_instance()
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-120>", line 2, in initialize
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users//anaconda/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 454, in initialize
    self.init_kernel()
  File "/Users//anaconda/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 365, in init_kernel
    user_ns=self.user_ns,
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/Users//anaconda/lib/python3.6/site-packages/clingkernel.py", line 101, in __init__
    whichCling = os.readlink(shutil.which('cling'))
TypeError: readlink: path should be string, bytes or os.PathLike, not NoneType
[I 20:52:23.761 NotebookApp] KernelRestarter: restarting kernel (2/5)
Traceback (most recent call last):
  File "/Users//anaconda/bin/jupyter-cling-kernel", line 4, in <module>
    main()
  File "/Users//anaconda/lib/python3.6/site-packages/clingkernel.py", line 344, in main
    ClingKernelApp.launch_instance()
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-120>", line 2, in initialize
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users//anaconda/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 454, in initialize
    self.init_kernel()
  File "/Users//anaconda/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 365, in init_kernel
    user_ns=self.user_ns,
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/Users//anaconda/lib/python3.6/site-packages/clingkernel.py", line 101, in __init__
    whichCling = os.readlink(shutil.which('cling'))
TypeError: readlink: path should be string, bytes or os.PathLike, not NoneType
[I 20:52:26.771 NotebookApp] KernelRestarter: restarting kernel (3/5)
Traceback (most recent call last):
  File "/Users//anaconda/bin/jupyter-cling-kernel", line 4, in <module>
    main()
  File "/Users//anaconda/lib/python3.6/site-packages/clingkernel.py", line 344, in main
    ClingKernelApp.launch_instance()
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-120>", line 2, in initialize
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users//anaconda/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 454, in initialize
    self.init_kernel()
  File "/Users//anaconda/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 365, in init_kernel
    user_ns=self.user_ns,
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/Users//anaconda/lib/python3.6/site-packages/clingkernel.py", line 101, in __init__
    whichCling = os.readlink(shutil.which('cling'))
TypeError: readlink: path should be string, bytes or os.PathLike, not NoneType
[W 20:52:27.804 NotebookApp] Timeout waiting for kernel_info reply from 66454176-a4a3-4d56-b1d9-4ef88fa0195d
[I 20:52:29.780 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 66454176-a4a3-4d56-b1d9-4ef88fa0195d restarted
Traceback (most recent call last):
  File "/Users//anaconda/bin/jupyter-cling-kernel", line 4, in <module>
    main()
  File "/Users//anaconda/lib/python3.6/site-packages/clingkernel.py", line 344, in main
    ClingKernelApp.launch_instance()
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-120>", line 2, in initialize
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users//anaconda/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 454, in initialize
    self.init_kernel()
  File "/Users//anaconda/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 365, in init_kernel
    user_ns=self.user_ns,
  File "/Users//anaconda/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/Users//anaconda/lib/python3.6/site-packages/clingkernel.py", line 101, in __init__
    whichCling = os.readlink(shutil.which('cling'))
TypeError: readlink: path should be string, bytes or os.PathLike, not NoneType
[W 20:52:32.793 NotebookApp] KernelRestarter: restart failed
[W 20:52:32.794 NotebookApp] Kernel 66454176-a4a3-4d56-b1d9-4ef88fa0195d died, removing from map.
ERROR:root:kernel 66454176-a4a3-4d56-b1d9-4ef88fa0195d restarted failed!
[W 20:52:32.808 NotebookApp] Kernel deleted before session
[W 20:52:32.809 NotebookApp] 410 DELETE /api/sessions/8cb8bf43-8330-4f62-8932-eab94eb8e91c (::1) 2.60ms referer=http://localhost:8888/notebooks/Untitled4.ipynb?kernel_name=cling-cpp14
[I 20:54:17.747 NotebookApp] Saving file at /Untitled4.ipynb

【问题讨论】:

【参考方案1】:

然后我从我的桌面打开了一个笔记本,

看起来笔记本没有在$PATH 中找到紧贴二进制文件。当前的主人应该表现得更好,并实际告诉你。你可以试试用https://root.cern/download/cling/https://root.cern/download/cling/的明天晚上

要解决您手头的问题,请从可访问cling 的终端启动笔记本,例如调整$PATH,或向/usr/local/bin/cling 添加符号链接。

【讨论】:

以上是关于C ++ jupyter内核死亡的主要内容,如果未能解决你的问题,请参考以下文章

内核在jupyter笔记本中不断死亡

Jupyter:内核似乎已经死亡。它将自动重启。 (与Keras相关)

Jupyter 错误 - 对于给定的一段代码,“内核似乎已经死亡,它将自动重新启动”

Jupyter笔记本 - Dead Kernel

丢失 jupyter notebook ssh 连接会杀死内核

在任务中访问 c​​elery worker 实例