CoCalc Public FilesInstall-ROOT-on-CoCalc.mdOpen with one click!
Authors: Samuel Lelièvre, Harald Schilly, ℏal Snyder
Views : 568
Description: Install ROOT on CoCalc
Compute Environment: Ubuntu 18.04 (Deprecated)

Install ROOT on CoCalc

--- by Samuel Lelièvre and Enrico Guiraud ---

This document presents how to install and use the ROOT software from CERN on CoCalc.

What is ROOT, what is CoCalc?


From the home page at

ROOT is ...

A modular scientific software framework. It provides all the functionalities needed to deal with big data processing, statistical analysis, visualisation and storage. It is mainly written in C++ but integrated with other languages such as Python and R.

Start from examples (link is external) or try it in your browser!


From the home page at

CoCalc: Collaborative Calculation in the Cloud / Online computing environment

sophisticated online environment for

  • Mathematical calculation: SageMath, GAP, SymPy, Maxima, …;
  • Statistics and Data Science: R Project, Pandas, Statsmodels, Scikit-Learn, TensorFlow, NLTK, …;
  • Document authoring: LaTeX, Markdown/HTML, ...
  • General purpose computing: Python, Octave, Julia, Scala, …

System-wide installation of ROOT on CoCalc

It exists but the version that is installed is from 2015.

Probably because it was packaged for Ubuntu 16.04.

Later versions of Ubuntu stopped packaging ROOT. (When you want to use ROOT, you want a recent version, so there is little point in having a version packaged in Ubuntu. You compile it.)

Read on for how to build the latest stable version of ROOT in a CoCalc project.

Install ROOT in a CoCalc project

One can simply download a binary for Ubuntu, from the page of the latest stable release:

Below we explain how to compile ROOT from source. Compiling ROOT is useful in case you need to turn on/off certain parts of ROOT, or if you want to compile with -std=c++14 or other things like that.

Upgrade the CoCalc project

For downloading and building ROOT, we need some upgrades to our CoCalc project:

  • disk space: the standard 3000 MB are not enough, it is suggested to double it;
  • internet access: otherwise we cannot git clone;
  • member hosting: to ensure the project will not restart during the build;
  • optionally, extra cores and extra RAM will make the build faster; I added 4 cores and upgraded to 10000 MB of RAM.

Download ROOT in a CoCalc project

We follow the instructions at:

First step: prerequisites

Required packages:

sudo apt-get install git dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev \
libxft-dev libxext-dev

Optional packages:

sudo apt-get install gfortran libssl-dev libpcre3-dev \
xlibmesa-glu-dev libglew1.5-dev libftgl-dev \
libmysqlclient-dev libfftw3-dev libcfitsio-dev \
graphviz-dev libavahi-compat-libdnssd-dev \
libldap2-dev python-dev libxml2-dev libkrb5-dev \
libgsl0-dev libqt4-dev

Luckily all the prerequisites are installed system-wide on CoCalc.

Second step: get sources

We follow the instructions at:

Clone the git repository:

$ git clone

Change directory to the cloned repository:

$ cd root

Get a list of all tagged versions:

$ git tag -l

Select the latest one, currently v6-12-06:

$ git checkout -b v6-12-06 v6-12-06

Build ROOT in our CoCalc project

Following the instructions at

Make a new directory and change to it:

$ cd
$ mkdir ROOT-v6-12-06
$ cd ROOT-v6-12-06


$ cmake ../root

Build (using several cores if we have them):

$ cmake --build . -- -j4

Start ROOT

Source the environment to run:

$ cd
$ source ROOT-v6-12-06/bin/

Starting the root application fails because it realises the display options in CoCalc will not allow its graphics capabilities.

$ root
root: can't figure out DISPLAY, set it manually
In case you run a remote ssh session, restart your ssh session with:
=========>  ssh -Y

Related CoCalc issues:

We can start root with the -b flag, which tells it to run in batch mode without graphics.

$ root -b
  | Welcome to ROOT 6.12/06       |
  |                               (c) 1995-2017, The ROOT Team |
  | Built for linuxx8664gcc                                    |
  | From tag v6-12-06, 9 February 2018                         |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |

root [0]

Type .q to quit.

root [0] .q

Try the ROOT package in Python

~$ python
Python 2.7.12 (default, Dec  4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> h = ROOT.TH1F()
>>> h.Fill(5)

Type CTRL-D to exit.

Try launching the ROOT Jupyter notebook naively

This fails because it wants to run JupyterLab, which is not yet supported in CoCalc.

~$ root --notebook
[I 20:40:25.533 NotebookApp] [jupyter_nbextensions_configurator] enabled 0.4.0
[I 20:40:25.580 NotebookApp] JupyterLab beta preview extension loaded from /usr/local/lib/python3.5/dist-packages/jupyterlab
[I 20:40:25.580 NotebookApp] JupyterLab application directory is /usr/local/share/jupyter/lab
[I 20:40:27.944 NotebookApp] Loading the assignment_list nbgrader serverextension
[I 20:40:27.955 NotebookApp] Loading the formgrader nbgrader serverextension
[W 20:40:27.960 NotebookApp] No file found (rerun with --debug to see where nbgrader is looking)
[I 20:40:27.981 NotebookApp] Loading the validate_assignment nbgrader serverextension
[I 20:40:27.986 NotebookApp] Serving notebooks from local directory: /home/user
[I 20:40:27.987 NotebookApp] 0 active kernels
[I 20:40:27.987 NotebookApp] The Jupyter Notebook is running at:
[I 20:40:27.987 NotebookApp] http://localhost:8888/?token=b22ca25c00286de11487bf7304e561cd243d9eeca75ce2e1
[I 20:40:27.987 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 20:40:28.015 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:

Exit with ctrl-C ctrl-C.

Related CoCalc issues:

Try PyROOT in the Jupyter notebook the CoCalc way


Using the CoCalc interface, create a new Jupyter notebook worksheet, say try-pyroot.ipynb.

Use the "Python 2 (Ubuntu)" Jupyter kernel.


I'm stuck here, I need help to get further.

Try the ROOT C++ kernel for Project Jupyter in CoCalc

Create a Jupyter notebook document in CoCalc, say try-root-cpp.ipynb.

In this notebook worksheet, use the menu item Kernel > Refresh Kernel List. Once that is done, we can select the ROOT C++ Jupyter kernel.