Where to Get Software

Toolchain

The toolchain consists of a number of pieces of software required to build other software. This generally comprises the C/C++ libraries; a C/C++ compiler; tools to handle, load and execute binary files and a set of kernel headers.

For example the default toolchain available on machines running Centos7 consists of:

  • gcc 4.8.5

  • glibc 2.17

  • binutils 2.27

  • kernel-headers 3.10.0

If support for C++11 or later is required, this toolchain is too old, and a newer one needs to be used.

Anaconda

Anaconda is a software distribution tool for Python packages. The distribution happens through so-called channels. The default channel is administered by the developers of Anaconda: Anaconda Inc. There is also a community-managaged channel called conda-forge and anybody can create and use their own channel.

To keep up with demands on the toolchain of various dependencies of python packages, Anaconda ships its own (modern) toolchain.

Because the software environment can be regenerated, it is recommended to install somewhere into /data instead of /project or your home directory.

To install anaconda, the Miniforge version is recommended, which sets conda-forge as the default channel. Download an installer from this page, and install it somewhere on /data; for example:

$> cd /data/your_project/your_username
$> wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
$> bash Miniforge3-Linux-x86_64.sh -b -p /data/your_project/your_username/conda

The final step of the conda installation will modify your shell startup scripts to automatically make the conda command available. You’ll have to log out and back in to see these changes.

Creating a virtualenv with Conda

Once conda is installed it can be used to create a virtual environment anywhere you like, for example on /data; the python version you need can also be specified:

$> conda create --prefix /data/your_project/your_username/my_venv python=3.9

It may happen that some of the packages that you would like to install into the environment are only available for certain python versions, so pay attention to that when you create the virtual environment.

Once the virtual environment has been created, you can activate it using:

$> conda activate /data/your_project/your_username/my_venv

Installing Python packages inside the conda environment

Once the virtual environment has been created and activated, it is ready to be used. The first step is usually to install additional software into the environment. There are two ways of doing this: with conda and with pip. The rule of thumb is: try with conda first and if a package is not available, try with pip.

The main reason for this ordering is that for some packages pip uses the C/C++/fortran toolchain to build libraries that are then loaded into python. It, however, doesn’t know about the (newer) toolchain installed by conda and will use the one on the (Centos 7) host instead. For quite a few packages this toolchain is too old and the build will fail. When packages are installed with conda, they have been prebuilt using the conda toolchain and will therefore work anyway.

with Conda

To install additional software into the virtual environment using conda itself: activate it and install:

$> conda activate /data/your_project/your_username/my_venv
(my_venv) $> conda install root

Packages available in conda can be searched using:

$> conda search root

with pip

To install additional software into the virtual environmet ,with pip: activate it, install pip itself and then use it to install other software; e.g.:

$> conda activate /data/your_project/your_username/my_venv
(my_venv) $> conda install pip
(my_venv) $> pip install keras
(my_venv) $> pip install tensorflow-gpu

Using the software

Once things are installed, they can be used directly:

(my_venv) $> python
Python 3.9.7 (default, Sep 16 2021, 13:09:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ROOT import gROOT
>>> gROOT.GetVersion()
'6.24/06'
>>>