Anaconda
Anaconda (the conda
command) is a software manager that allows you
download packages to your home directory.
If you use the Nevis particle-physics Linux cluster, then you don’t need Anaconda for this tutorial. But if you’re on a different system that doesn’t have ROOT installed, or your system doesn’t offer the package or version you’re looking for, Anaconda offers an alternative. You can install Anaconda in your home directory so admin access is not necessary. Simply follow the web site directions to install Miniconda1.
Once you’ve installed Anaconda, you’ll want to include conda-forge for packages such as ROOT. The following commands set it up:
conda config --add channels conda-forge
conda config --set channel_priority strict
At this point, you’ll probably have to log off then log in to your computer again to give conda a chance to set up your shell.
To install Jupyter/ROOT, with sufficient features for most of this tutorial:
conda create --name jupyter-pyroot compilers python jupyter jupyterlab root
Note that the name jupyter-pyroot
is arbitrary; you can use any name
for the conda
environment
that you wish.
If you continue to work with Jupyter or ROOT after this tutorial, there are standard packages that you’ll probably want to include:
conda install --name jupyter-pyroot numpy scipy matplotlib
Your working group may use additional packages. For example, the VERITAS group at Nevis might want to use (in addition to the above):
conda install --name jupyter-pyroot astropy gammapy
You only have to go through the above steps once to define an
environment (e.g., jupyter-pyroot
). Afterwards, once per login
session, it’s necessary to activate it:
conda activate jupyter-pyroot
Once activated, you should be able to run ROOT by simply typing:
root
You can run jupyterlab with:
jupyter lab
Windows users
The above instructions for installing ROOT won’t work under MS-Windows. You can install conda, but the ROOT windowing system so heavily depends on X11 that ROOT is simply not available in the conda libraries for Windows, even if you you’ve installed an X11 emulation such as MobaXterm.
Windows Subsystem for Linux (WSL) with Ubuntu distribution won’t quite solve this problem. You’ll still need an external X11 server program like mobaXterm. I found this guide to get you started, though that page recommends using Vcxsrc instead of mobaXterm.
Using conda
Conda takes a long time to run. Be patient. I’ve seen some conda environments take hours or even days to install.
Anaconda changes your shell’s execution environment. It may be incompatible with other environment setups (such as MicroBooNE’s LArSoft or ATLAS’ Athena).
Your shell’s prompt will be changed by conda. Even when you’re not using conda, the text
(base)
will appear at the beginning of the prompt. If this doesn’t bother you, then ignore it. If it does, you can try:conda config --set auto_activate_base false
You’ll have to log off then log in again to see the change. If you don’t want conda to alter your prompt even when you’re using an environment, this command will suppress conda’s prompt changes:
conda config --set changeps1 False
Conda and disk space
A conda environment can take up a lot of space. It not only installs the packages you list, but any other packages that they depend on. On my desktop computer, the minimal Jupyter/ROOT container described above takes up 3GB. This may not seem like much, but summer students at Nevis have a disk quota of 10GB.
It’s possible to run into disk-space problems, especially if you’re sharing disk space with other users, if you add more packages to your environment, or you define multiple environments for different projects.
There’s some advice on how to deal with conda’s “hidden” disk usage on the Nevis wiki.
One of the common questions I’m asked is how to relocate a conda environment to some other location than one’s home directory:
Most Nevis research groups have additional disk storage that’s not part of a home directory. You can read about how the Nevis particle-physics groups handle their storage in Shared filesystems.
Many research groups want to share their conda environments, to make sure that everyone is using the same versions.
For tips on managing disk space for your conda environments, see the Nevis conda wiki page. The conda page on managing environments is also helpful.
- 1
For this tutorial, the full Anaconda set of packages is not necessary. Note that all the Nevis particle-physics systems already have conda installed.