Skip to content
hero
Philippe Bordron

Configure conda

Objectives

  1. Move the folder where conda store data (cache, packages, environments, ...) from your home to the work.
  2. Add channels for installing bioinformatics tools.
  3. Disable default channels that can be subject to billing.

This configuration needs to be done only once.

Move conda data to the work

By default, conda stores packages and environments in the $HOME. If left in this state, by using conda, you will quickly fill your $HOME quota and block your account. So we're going to make sure that these files are stored on the work.

# We check that no folder `conda` exists.ls -als ~/.conda# If the folder exists, we move it to the workmv ~/.conda ~/work/# Else, we create itmkdir ~/work/.conda# Finally we create a symbolic link to maintain compatibilityln -s ~/work/.conda ~/

Conda documentation provides other ways to set the place conda store data.

Add bioinformatics conda channels

The bioconda channel contains many packages for bioinformatics. It is added as follows:

# We enable conda on the clustermodule load devel/Miniforge/Miniforge3# We add the `bioconda` channel (obvious).conda config --add channels bioconda# We add `conda-forge` channel, it provides many dependencies for `bioconda`conda config --add channels conda-forge# Channel priority must be respected.# It improve compatibility and speed up the resolution of dependenciesconda config --set channel_priority strict

The search for dependencies is faster and improves compatibility between dependencies by indicating to respect channel priority. The last channel added, in this case conda-forge, has the highest priority (i.e. higher priority than bioconda).

Disable Anaconda channels (defaults)

Defaults channel

Anaconda channels are subject to paying subscription. To be sure you don't use them in your projects, the conda documentation indicates how to disable them

# We enable conda on the cluster (if not done already)module load devel/Miniforge/Miniforge3# We disable `defaults` channelconda config --remove channels defaultsconda config --append channels nodefaults# We forbib to use `defaults` channels in any caseconda config --add denylist_channels defaults

How to check the conda configuration?

If you have followed this page correctly, the ~/.condarc configuration file should contain:

cat ~/.condarcchannels:
- conda-forge
- bioconda
- nodefaults
channel_priority: strict
denylist_channels:
- defaults