Conda / Mamba
Overview
Conda is a cross-platform package and environment manager widely used in bioinformatics. Mamba is a drop-in replacement that resolves dependencies in C++ and is significantly faster. Together with the Bioconda channel they provide pre-built packages for thousands of bioinformatics tools.
This page covers installation, environment management, and best practices for reproducible analyses.
Installation
Install Miniforge, a minimal Conda distribution that bundles Mamba and
defaults to conda-forge.
# Install Miniforge (includes mamba)
curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
bash Miniforge3-Linux-x86_64.sh
Note
On macOS, replace Linux-x86_64 with MacOSX-x86_64 (Intel) or
MacOSX-arm64 (Apple Silicon).
After the installer finishes, restart your shell so that the mamba and
conda commands are available.
Basic Usage
Creating an environment
Always create a dedicated environment per project and pin package versions.
# Create an environment for an RNA-seq project
mamba create -n rnaseq -c conda-forge -c bioconda \
fastqc=0.12.1 fastp=0.23.4 star=2.7.11b \
subread=2.0.6 samtools=1.19 multiqc=1.21
Activating and deactivating
# Activate the environment
mamba activate rnaseq
# When finished
mamba deactivate
Exporting and sharing
# Export the environment for reproducibility
mamba env export > environment.yml
A collaborator recreates the same environment with:
mamba env create -f environment.yml
Listing environments and packages
# List all environments
mamba env list
# List packages in the active environment
mamba list
Removing an environment
mamba env remove -n rnaseq
Key Parameters
mamba create
Flag |
Description |
|---|---|
|
Name of the new environment. |
|
Channel to search (repeat for multiple channels). |
|
Ignore default channels; use only those given with |
|
Resolve from channels in order (recommended to avoid mixed builds). |
mamba install
Flag |
Description |
|---|---|
|
Install into a named environment (instead of the active one). |
|
Also update existing dependencies as needed. |
|
Show what would be installed without making changes. |
Best practices
Pin versions –
samtools=1.19ensures everyone gets the same build.One environment per project – avoids dependency conflicts across unrelated tools.
Prefer Mamba – identical syntax to
condabut 10–100x faster dependency solving.Keep base clean – never install analysis tools into the
baseenvironment.
Expected Output
After creating and activating the rnaseq environment:
which fastqc
# ~/miniforge3/envs/rnaseq/bin/fastqc
fastqc --version
# FastQC v0.12.1
samtools --version | head -1
# samtools 1.19
See Also
Installation – quick-start Miniforge setup
Docker – containerise your pipeline with Docker
Singularity / Apptainer – run containers on HPC where Docker is unavailable