Anaconda

Anaconda is a software manager that allows you download and execute packages in your home directory.

If you use the Nevis Linux cluster, then you should consider using environment modules over Anaconda. But if you’re on a different system, or the Nevis environment modules don’t offer the package or version you’re looking for, Anaconda is a better choice. 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 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.

The solution is to install Windows Subsystem for Linux (WSL) on your laptop; you’ll probably want to install the Ubuntu distribution. Then install conda within Ubuntu, and continue as above.

You may also need MobaXterm to provide ROOT with an X11 server.

Warning

  • Conda takes a long time to run. Be patient. I’ve seen some conda environments take hours to install.

  • A conda environment can take up a lot of disk space, since 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 3G. This may not seem like much, but summer students at Nevis have a disk quota of 10G.

    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.

  • Anaconda changes your shell’s execution environment. It may be incompatible with other environment setups (such as MicroBooNE’s LArSoft, ATLAS’ Athena, or Nevis’ module load command).

  • 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
    

Tip

One of the most common questions I’m asked is how to relocate a conda environment to some other location than one’s home directory:

  • As noted above, conda environments take up a lot of disk space. Most 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.