Skip to content

Instantly share code, notes, and snippets.

@jetsup
Last active June 24, 2024 06:27
Show Gist options
  • Save jetsup/325ac761005dbdecae146085f1a6d5ef to your computer and use it in GitHub Desktop.
Save jetsup/325ac761005dbdecae146085f1a6d5ef to your computer and use it in GitHub Desktop.
Installing xeus-cling on Linux

Xeus-Cling finalization

So after installing xeus-cling using instructions from their official documentation, I found out that I could not add the c++11, c++14 and c++17 directly to the jupyter notebook.

Also, to let you know, I am using miniconda3 installed from their official website running on Ubuntu 22.04. Therefore, from the xeus-cling github repo, I will be replacing mamba with conda where for xeus-cling installation, I ran the following commands:

conda create -n cling
conda activate cling
conda install xeus-cling -c conda-forge

Everything runs fine until it's time to install the Kernel Spec, where it might be confusing for starters. The commands

jupyter kernelspec install PREFIX/share/jupyter/xcpp11 --sys-prefix
jupyter kernelspec install PREFIX/share/jupyter/xcpp14 --sys-prefix
jupyter kernelspec install PREFIX/share/jupyter/xcpp17 --sys-prefix

might be intimidating at first.

If you did not change anything during installation, the miniconda will have been installed in the directory, /home/$USERNAME/miniconda3.

Turns out that the jupyter kernels are installed in /home/$USERNAME/miniconda3/share/jupyter/kernels.

To install the kernels, replace PREFIX/share/jupyter/xcpp17 with /home/$USERNAME/miniconda3/share/jupyter/kernels. Therefore the commands are:

jupyter kernelspec install /home/$USERNAME/miniconda3/share/jupyter/kernels/xcpp11 --sys-prefix
jupyter kernelspec install /home/$USERNAME/miniconda3/share/jupyter/kernels/xcpp14 --sys-prefix
jupyter kernelspec install /home/$USERNAME/miniconda3/share/jupyter/kernels/xcpp17 --sys-prefix

For these commands you might require to run them as sudo or append --user to install to the current user only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment