This lesson is in the early stages of development (Alpha version)

Use Conda to install root

Overview

Teaching: 30 min
Exercises: 0 min
Questions
  • How do I get root and jupyter-lab for simple analysis

Objectives
  • get miniconda set up on your machine

  • install root and jupyter-lab

Here are instruction on how to set up a package manager (conda) and install ROOT.

Why do we need a package manager? ROOT is a complicated program that needs to have consistent versions of python and other products to work properly. By using a package manager, we can maintain consistency.

Installing conda and root

This is derived from the excellent https://iscinumpy.gitlab.io/post/root-conda/ by Henry Schreiner

Currently this has been tested on OSX and Linux distributions SL7 and AL9

1. Download miniconda (or Anacoda)

Miniconda is a free subset of the Anaconda package manager. Anaconda is free for individual use but can run into licensing issues so many people go with Miniconda.

Miniconda

  1. Do you have wget on your system? If not, get it

wget

  1. Download the miniconda installer
# Download the Linux installer
wget -nv http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
# Or download the macOS installer
wget -nv https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh

Install conda

# Install Conda (same for macOS and Linux)
bash miniconda.sh -b -p $HOME/miniconda
  1. add this to your .bashrc or .profile to start it up when you log in
source $HOME/miniconda/etc/profile.d/conda.sh # Add to bashrc - similar files available for fish and csh

Making an environment with root in it

conda create -n my_root_env root -c conda-forge

This will take a while. In the end you have an environment which contains root and a lot of other useful things

You can repeat step 1 to make different conda enviroments which you can use for different projects!

Try out your new environment

To activate a particular environment you do:

conda activate my_root_env

First time you use your environment you can do

conda config --add --env channels conda-forge

the config command tells conda to use conda-forge as a default. You should now have a conda environment with root in it.

You can use conda to install other code (for example I have installed, ruby, jupyterlab and jsoncpp for various projects).

Testing

(my_root_env) wngr405-mac3:utilities schellma$ root
   ------------------------------------------------------------------
  | Welcome to ROOT 6.28/00                        https://root.cern |
  | (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for macosx64 on Mar 21 2023, 08:18:00                      |
  | From tag , 3 February 2023                                       |
  | With                                                             |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------

root [1] .q

To get out of root type

root> .q

Try this

root -l -q $ROOTSYS/tutorials/dataframe/df013_InspectAnalysis.C

You should see a plot that updates.

Key Points

  • useful mainly for simple tuple analysis