conda (software installation)
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.
This is how the conda
documentation puts it.
One more major selling-point: you don't need administrator rights to install conda itself or to install packages with it.
And for our (bioinformatic) purposes, there are two more very useful aspects:
- There is
bioconda
, aconda
channel with pretty much any tool in bioinformatics pre-packaged for you. conda
seemlessly integrates withsnakemake
for automatic software installation in automated analysis workflows.
installing conda
We recommend using the miniforge installation and recommend a conda
version >= 24.7.1
.
The latter is the minimum conda version that snakemake
requires at the time of writing (since conda >= 23.10.0
, it uses the fast dependency solver previously only included in mamba
).
creating and using environments
conda
makes it easy to create and manage new (named) software environments.
We recommend to create a new (and minimal) software environment whenever possible (for example, in a snakemake workflow, each rule will have its own software environment).
You will then only activate that software environment whenever you need the software installed into it.
By keeping environments minimal, you avoid clashes in the dependencies that software might have (for example, if software X needs python version 3, while software Y still requires python version 2, these cannot be installed into the same environment---but X and Y will happily install in separate environments, which will pull in the required python version).
But, long story short, here's the command to create an environment:
conda create -n snakemake_env snakemake snakedeploy snakefmt
You can then activate that environment with:
conda activate snakemake_env
And you will be able to call the installed tools, for example snakemake
:
snakemake --version
snakemake --help
If you are done with your current session of using the software, the following gets you back to your original environment (the one you were in before activating snakemake_env
):
conda deactivate
If you no longer need the entire environment (and the software contained in it) and want to delete it, you can:
conda env remove -n snakemake_env
And then, there are many other things you can do with environments---just look up the details whenever you need them.
installing specific versions of software
Sometimes, you want to install a specific version of a software, for example because something was proven to work with that version in the past. You can achieve this with:
conda create -n snakemake_env_7_19_1 snakemake=7.19.1
And in case you ever need to dive into the details, there is of course documentation on how conda
handles version number specifications.