From How to install cling?, I've downloaded the pre-installed binaries for cling-ubuntu on https://root.cern.ch/download/cling/
$ wget https://root.cern.ch/download/cling/cling_2017-03-30_ubuntu16.tar.bz2
$ dtrx cling_2017-03-30_ubuntu16.tar.bz2
$ cd cling_2017-03-30_ubuntu16
$ ls
~/cling_2017-03-30_ubuntu16/$ ls
bin include lib libexec share
~/cling_2017-03-30_ubuntu16/$ cd share/cling/Jupyter/kernel/
~/cling_2017-03-30_ubuntu16/share/cling/Jupyter/kernel/$ ls
build cling-cpp14 cling.ipynb clingkernel.py scripts
cling-cpp11 cling-cpp17 clingkernel.egg-info __pycache__ setup.py
On the documentation, it says:
pip install -e .
But when it comes to the step:
# register the kernelspec for C++17/C++14/C++11:
# the user can install whichever kernel(s) they
Which C++ version should I use? I didn't have any of those installed? I use gcc
to compile my c++ code usually.
And even when I tried installing all with:
jupyter-kernelspec install cling-c++17
jupyter-kernelspec install cling-c++14
jupyter-kernelspec install cling-c++11
The Jupyter notebook shows the kernel but at the home page but when I create a new notebook, the kernel either dies or keeps restarting.
I tried your steps and also ran into problems. I had better luck building from source, installing the built kernel, and running with that. I don't have details on your build; make sure you remove any previous kernels from Jupyter before trying this. To do this, based on your input above, use the following commands:
~/cling_2017-03-30_ubuntu16/share/cling/Jupyter/kernel
jupyter kernelspec uninstall cling-cpp11
Now, here are my build instructions (I'm running Ubuntu 16.04):
mkdir -p ~/builds && cd ~/builds
wget https://root.cern.ch/download/cling/cling_2017-04-15_sources.tar.bz2
tar jxf cling_2017-04-15_sources.tar.bz2
mv src cling_2017-04-15
mkdir -p ~/builds/cling_2017-04-15/build
cd ~/builds/cling_2017-04-15/build
cmake -DCMAKE_BUILD_TYPE=Release ../
make -j8
sudo make install
sudo ldconfig
cd /usr/local/share/cling/Jupyter/kernel
sud pip3 install -e .
sudo jupyer kernelspec install cling-cpp11
cd ~ && jupyter notebook
Now, here's a simple example in Jupyter you can try. Cling is evolving, so check out the doc for the latest syntax.
There may be a discrepancy in the kernelspec directory naming between those docs and the current code. It seems they now use "cpp" instead of "c++". Using e.g.
worked better on my cling_2017-03-30_ubuntu16 install.