5

I built Cling on my laptop with Ubuntu 15.04 following the instructions given on https://github.com/root-mirror/cling#jupyter because I wanted to use the Cling kernel for Jupyter. I installed Jupyter, I checked that Cling is in my PATH, but when I type the command

jupyter kernelspec install cling

I get the following

OSError: [Errno 2] No such file or directory: 'cling'

Someone knows what's happening?

3 Answers3

5

According to the source code, jupyter kernelspec install command expects the path to the directory containing kernel spec file (kernel.json) as an argument. So if you cloned the cling repository in, say, ~/cling/src, this should work:

jupyter kernelspec install ~/cling/src/tools/cling/tools/Jupyter/kernel/cling
Community
  • 1
  • 1
fnis
  • 143
  • 1
  • 2
  • 8
  • 1
    Oh, and you'll also need to install clingkernel python package by `pip install ~/cling/src/tools/cling/tools/Jupyter/kernel`. – fnis Feb 29 '16 at 07:10
  • Thank you @user5266681, this command was missing! It looks to have worked fine, I see the c++ kernel in the list of available kernels on Jupyter, but when I open a notebook the kernel dies. – Alessandro Gentile Mar 02 '16 at 15:36
  • 1
    Cling kernel uses python3. So I think you need to `apt-get install python3-pip` and reinstall the kernel by `pip uninstall clingkernel` followed by `pip3 install`. – fnis Mar 02 '16 at 19:59
3

That's probably because in your folder 3 versions of Cling kernel are defined (C++11, C++14 and C++17).
So instead of trying to add Cling try to add one of those versions or all three if you want to.

enter image description here

zx485
  • 28,498
  • 28
  • 50
  • 59
0

I had the same problem just one minute ago, but I was able to solve it. I executed:

$ jupyter kernelspec install --user cling-cpp11

directly from /home/ubuntu_user/cling_ubuntu/share/cling/Jupyter/kernel.

The installation was successful, I moved to my working directory and called a jupyter notebook; it opened ok, but the kernel immediately died.

I thought the problem was that I have to install cling from where I was going to call the jupyter notebook, and I did so:

After uninstalling the kernel (also from /home/ubuntu_user/cling_ubuntu/share/cling/Jupyter/kernel) with:

jupyter kernelspec uninstall cling-cpp11

I repeated all the installation process:

Let's assume that you are usually going to call jupiter from /home/ubuntu_user, and you have your cling repository here

/home/ubuntu_user/cling_ubuntu.

Then:

  1. Go there: $ cd /home/ubuntu_user
  2. $ source activate my_env (I work with Anaconda, so I activated my environment)
  3. $ export PATH=/home/ubuntu_user/cling_ubuntu/bin:$PATH
  4. $ cd cling_ubuntu/share/cling/Jupyter/kernel/cling-cpp11
  5. $ pip install -e.
  6. Here you have to move to your future working directory.

    $ cd /home/ubuntu_user, type:

    $ jupyter kernelspec install --user cling_ubuntu/share/cling/Jupyter/kernel/cling-cpp11

    .. and the kernel is still alive and works ok.

Mina
  • 1
  • 1