--- by Samuel Lelièvre and Enrico Guiraud ---
This document presents how to install and use the ROOT software from CERN on CoCalc.
From the home page at https://root.cern.ch/
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 https://cocalc.com/index.html
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, …
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.
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.
For downloading and building ROOT, we need some upgrades to our CoCalc project:
We follow the instructions at: https://root.cern.ch/building-root
First step: prerequisites
sudo apt-get install git dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev \ libxft-dev libxext-dev
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 http://root.cern.ch/git/root.git
Change directory to the cloned repository:
$ cd root
Get a list of all tagged versions:
$ git tag -l
Select the latest one, currently
$ git checkout -b v6-12-06 v6-12-06
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
Source the environment to run:
$ cd $ source ROOT-v6-12-06/bin/thisroot.sh
root application fails because it realises
the display options in CoCalc will not allow its graphics
$ 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:
CoCalc issue 135: add html5 vnc support for SMC projects so that we can use X11, X windows applications -- noVNC looks good https://github.com/sagemathinc/cocalc/issues/135
CoCalc issue 2374: Install basic X11 support libraries, QT, etc., in our base linux image, to make building software easier https://github.com/sagemathinc/cocalc/issues/2374
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 http://root.cern.ch | | (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 
.q to quit.
root  .q $
~$ 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) -1 >>>
Type CTRL-D to exit.
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 nbgrader_config.py 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: http://localhost:8888/?token=b22ca25c00286de11487bf7304e561cd243d9eeca75ce2e1
Related CoCalc issues:
CoCalc issue 2553: Provide a JupyterLab view of projects https://github.com/sagemathinc/cocalc/issues/2553
CoCalc issue 2715: add "jupyter lab" start button in project settings https://github.com/sagemathinc/cocalc/issues/2715
Using the CoCalc interface, create a new Jupyter notebook worksheet,
Use the "Python 2 (Ubuntu)" Jupyter kernel.
I'm stuck here, I need help to get further.
Create a Jupyter notebook document in CoCalc,
In this notebook worksheet, use the menu item
Kernel > Refresh Kernel List. Once that is done,
we can select the
ROOT C++ Jupyter kernel.