Conda is a package, software and environment manager, that can be used to install and manage software in so called “environments”. This allows you to install software, which dependencies are not available in the system or conflict with other software versions.
This guide is focused on Python programs, but conda is not limited to those.
Note: Anaconda modifies the .bashrc during setup. This file is not read by default on login on our Cluster, see here for more info.
This section provides a minimal example on how to use conda.
# load the anaconda module (this gives you the default version, # use e.g. anaconda3/2020.07 to load a specific version) module load anaconda3/2020.07 # create a new environment named 'my_env' conda create -n my_env # activate the freshly created environment source activate my_env # install packages to my_env conda install numpy matplotlib # now you can use the packages you installed # exit the environment source deactivate
After loading the conda module, one can create a new environment in different ways (of course you can use a different name than 'my_env'):
# using a name, the environment will be created in $HOME/.conda/envs conda create -n my_env # to create the environment in a specific location, execute one of the following: conda create -p /path/to/directory/my_env # absolute path conda create -p my_env # path relative to the current working directory # create a new environment with packages (here: deeptools and all its dependencies) conda create -n my_env deeptools # create a new environment for a specific python version conda create -n py27_env python=2.7
Although the conda module already includes pip (a very old version), it's better to install it in an environment.
# load the anaconda3 module module load anaconda3 # create an environment containing a recent version of pip # note that you could use a different name than 'pip_test' conda create -n pip_test pip # activate the environment (change the name accordingly) source activate pip_test # install some packages using pip # '--user' is important, otherwise you may get permission errors pip install --user tensorflow