C++ jupyter kernel death

854 Views Asked by At

I have the following traceback when I start a c++14 jupyter kernel using cling. I downloaded cling_2018-01-11_mac1012.tar.bz2 from

https://root.cern.ch/download/cling/

Then added bin to the path. To do that I opened a terminal and entered

sudo nano /etc/paths

Popped my password in and then, at the bottom of the file, entered the path of the binary folder from the download (which I got from hitting command i on the file to get info), quit and saved the buffer. Test it worked using

echo $PATH 

Once it has been added to the path, open up a new terminal. cd into the download, then installed the kernel in:

/share/cling/Jupyter/kernel

pip install .

jupyter kernelspec install cling-cpp14

I then opened a notebook from my desktop, opened a c++14 notebook, but unfortunately the kernel dies. Here is the traceback. Any help appreciated.

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

There are 1 best solutions below

0
On

I then opened a notebook from my desktop,

Looks like the notebook didn't find the cling binary in $PATH. The current master should behave nicer and actually tell you. You can try using tomorrow's nightly from https://root.cern/download/cling/

To fix your issue at hand, start the notebook from a terminal that has cling accessible, for instance by adjusting $PATH, or by adding a symlink to /usr/local/bin/cling.