Conda#

Conda is an open source package management system and environment management system that runs on Windows, macOS and Linux. Conda quickly installs, runs and updates packages and their dependencies.

Installing Miniconda#

The simplest way to install Conda for use on Bede is through the miniconda installer.

Note

You may wish to install conda into the /nobackup/projects/<project>/$USER/<architecture> (where <project> is the project code for your project, and <architecture>> is CPU architecture) directory rather than your home directory as it may consume considerable disk space

export CONDADIR=/nobackup/projects/<project>/$USER/ppc64le # Update this with your <project> code.
mkdir -p $CONDADIR
pushd $CONDADIR

# Download the latest miniconda installer for ppc64le
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-ppc64le.sh
# Validate the file checksum matches is listed on https://docs.conda.io/en/latest/miniconda_hashes.html.
sha256sum Miniconda3-latest-Linux-ppc64le.sh

sh Miniconda3-latest-Linux-ppc64le.sh -b -p ./miniconda
source miniconda/etc/profile.d/conda.sh
conda update conda -y

Using Miniconda#

On subsequent sessions, or in job scripts you may need to re-source miniconda. Alternatively you could add this to your bash environment. I.e.

arch=$(uname -i) # Get the CPU architecture
if [[ $arch == "ppc64le" ]]; then
   # Set variables and source scripts for ppc64le
   export CONDADIR=/nobackup/projects/<project>/$USER/ppc64le # Update this with your <project> code.
   source $CONDADIR/miniconda/etc/profile.d/conda.sh
fi

Creating a new Conda Environment#

With miniconda installed and activated, new conda environments can be created using conda create.

I.e. to create a new conda environment named example, with python 3.9 you can run the following.

conda create -y --name example python=3.9

Once created, the environment can be activated using conda activate.

conda activate example

Alternatively, Conda environments can be created outside of the conda/miniconda install, using the -p / --prefix option of conda create.

I.e. if you have installed miniconda to your home directory, but wish to create a conda environment within the /project/<PROJECT>/$USER/<architecture>/ directory named example you can use:

conda create -y --prefix /project/<PROJECT>/$USER/<architecture>/example python=3.9

This can subsequently be loaded via:

conda activate /project/<PROJECT>/$USER/<architecture>/example

Listing and Activating existing Conda Environments#

Existing conda environments can be listed via:

conda env list

conda activate can then be used to activate one of the listed environments.

Adding Conda Channels to an Environment#

The default conda channel does not contain all packages or may not contain versions of packages you may wish to use.

In this case, third-party conda channels can be added to conda environments to provide access to these packages, such as the Open-CE Conda channel hosted by Oregon State University.

It is recommended to add channels to specific conda environments, rather than your global conda configuration.

I.e. to add the OSU Open-CE Conda channel to the currently loaded conda environment:

conda config --env --prepend channels https://ftp.osuosl.org/pub/open-ce/current/

You may also wish to enable strict channel priority to speed up conda operations and reduce incompatibility which will be default from Conda 5.0. This may break old environment files.

conda config --env --set channel_priority strict

Installing Conda Packages#

Conda packages can then be installed using conda install <package>.

I.e. to install the conda package pylint into the active conda environment:

conda install -y pylint

Note

Only Conda packages with support for ppc64le will be installable.

Deleting Conda Environments#

You may need to delete conda environments when they are no longer required, to free up disk space. This can be achieved using conda env remove. I.e. to remove the example conda environment created before:

conda env remove -n example

Further Information#

See the Conda Documentation for further information.

Alternatively, conda provides its own help information for the main conda executable and all subcommands, such as conda list

conda -h
conda list -h