Introduction
If you work in bioinformatics, you’ve probably hit this moment: you’re trying to install a tool, and conda spends five minutes “solving the environment” before telling you it’s impossible. Or you have 47 different versions of Python scattered across your system, each one breaking something else when you use it.
By the end of this guide, you’ll have a clean, reproducible bioinformatics environment using Miniforge and Mamba — the current best-practice setup that your colleagues and collaborators should also be using. You’ll know how to create isolated environments for each project, install tools from the Bioconda channel (where all the good stuff lives), and avoid the common pitfalls that waste hours of troubleshooting.
This is hands-on: every command you need is here, tested and ready to copy-paste.
Prerequisites
- A Unix-like system (macOS, Linux, or Windows Subsystem for Linux 2)
- ~5 GB of disk space for Miniforge and a reasonable number of environments
- Administrator access to install software (on macOS, you may need to allow installation from unidentified developers)
- No existing Anaconda, Miniconda, or Mambaforge installation (if you have one, we’ll cover migration)
If you’re on Windows, you can use the native Windows installer, but WSL 2 is recommended for better performance and compatibility with bioinformatics tools.
Step 1: Install Miniforge, Not Anaconda or Miniconda
Miniforge is the recommended starting point for bioinformatics work in 2025–2026. Here’s why:
Miniforge vs. Anaconda vs. Miniconda:
| Factor | Anaconda | Miniconda | Miniforge |
|---|---|---|---|
| Includes pre-installed packages | Yes (100+) | No | No |
| Default channel | Anaconda’s defaults | Anaconda’s defaults | conda-forge |
| Includes mamba | No | No | Yes |
| License status | Commercial (paid for institutions) | Deprecated | Open-source, free |
| Speed | Slow | Slow | Fast (mamba built-in) |
| Recommended for 2026 | No | No | Yes |
Anaconda now requires paid licenses for most organizations. Miniconda is deprecated. Miniforge gives you conda and mamba in one install, uses the open-source conda-forge channel by default, and includes mamba for faster package resolution compared to older conda versions.
Download and Install Miniforge
Visit the official Miniforge releases page and download the latest version for your system (look for Miniforge3, not Mambaforge, which is being retired).
On macOS:
# Download the installer (choose Intel or Apple Silicon as appropriate)
curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
# Run the installer
bash Miniforge3-MacOSX-arm64.sh
On Linux:
# Download the installer
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
# Run the installer
bash Miniforge3-Linux-x86_64.sh
Follow the prompts. When asked whether to initialize conda, answer yes. This modifies your shell configuration to activate conda on startup.
After installation, close and reopen your terminal, or run:
source ~/.bashrc # Linux or WSL 2
source ~/.zprofile # macOS
Verify the installation:
mamba --version
Expected output (version number may differ):
mamba 1.5.8
conda 24.1.2
You now have both mamba and conda. Use mamba by default because it’s fully compatible with conda commands but faster.
Step 2: Initialize Conda and Update to Latest Version
Initialize conda properly and update it to the latest version:
mamba init
mamba update -n base -c conda-forge mamba conda -y
This ensures you’re running the latest solver improvements.
Step 3: Configure Channels for Bioinformatics
The key to bioinformatics work is setting up the right channels in the correct order. Bioconda packages depend on conda-forge, so channel priority matters.
Add the channels:
conda config --add channels bioconda
conda config --add channels conda-forge
conda config --set channel_priority strict
Verify your configuration:
cat ~/.condarc
Expected output:
channels:
- conda-forge
- bioconda
channel_priority: strict
The order is critical: conda-forge is highest priority, bioconda second. This prevents dependency conflicts.
Why strict channel priority? Without it, conda will search all channels for every package, leading to incompatible versions being selected. Strict priority ensures conda respects the order and picks from the first matching channel.
Step 4: Create Your First Project Environment
Never install packages into the base environment. It contaminates your system Python and makes it hard to troubleshoot environment-specific issues. Instead, create a project environment:
mamba create -n myproject python=3.11 -y
This creates an environment called myproject with Python 3.11. You can name it anything; use your actual project name.
Activate it:
mamba activate myproject
Your shell prompt should change to show (myproject) at the beginning.
Verify you’re in the environment:
python --version
which python
Expected output:
Python 3.11.8
/home/username/mambaforge/envs/myproject/bin/python
The path should point to your environment, not your system Python.
Step 5: Install Bioinformatics Tools
Now install actual tools from Bioconda. Let’s say you need samtools (for BAM file manipulation), bwa (alignment), and picard (variant calling):
mamba install -c bioconda -c conda-forge samtools bwa picard -y
Mamba will solve dependencies (usually in seconds) and install everything. You’ll see output like:
Looking for: ['samtools', 'bwa', 'picard']
Pinned packages:
- python 3.11.*
The following NEW packages will be installed:
bioconda/linux-64::samtools-1.19.2
bioconda/linux-64::bwa-0.7.17
bioconda/linux-64::picard-3.0.0
... (dependencies)
Proceed ([y]/n)?
Press y to confirm. Installation takes seconds to a few minutes depending on your internet and the tool complexity.
Verify installation:
samtools --version
bwa
picard -h
Each tool should respond with its help text or version information.
Step 6: Export and Share Your Environment
One of the biggest wins of conda is reproducibility. You can share your exact environment with collaborators or your future self.
Export your environment:
mamba env export > myproject.yml
This creates a YAML file with every package and version you installed:
name: myproject
channels:
- conda-forge
- bioconda
dependencies:
- python=3.11.8
- samtools=1.19.2
- bwa=0.7.17
- picard=3.0.0
- ... (full dependency tree)
prefix: /home/username/mambaforge/envs/myproject
Share this file with collaborators. They can recreate your exact environment:
mamba env create -f myproject.yml
This is the foundation of reproducible research.
Optional: Pinned Dependency Format
If you want a more human-readable environment file (especially for Git), you can manually create one:
cat > environment.yml << 'EOF'
name: myproject
channels:
- conda-forge
- bioconda
dependencies:
- python=3.11
- samtools
- bwa
- picard
EOF
This is less strict (versions aren’t pinned) but makes for cleaner version control. Install with:
mamba env create -f environment.yml
Step 7: Common Pitfalls and Troubleshooting
Problem 1: “Solving Environment” Hangs or Takes Forever
Cause: Too many packages in one environment, or conflicting channel priorities.
Solution: Create a fresh environment and install only what you need:
mamba create -n fresh_env python=3.11 -y
mamba activate fresh_env
mamba install samtools # one tool at a time if needed
If a specific tool installation hangs, interrupt it (Ctrl+C) and try with a fresh environment:
mamba create -n tool_only python=3.11 samtools -y
Problem 2: “Unsatisfiable Specifications” Error
Cause: Two packages require conflicting versions of a dependency (for example, one needs Python 3.9, another needs 3.11).
Solution: Create separate environments for incompatible tools:
# Old tool that needs Python 3.9
mamba create -n legacy python=3.9 oldtool
# Modern tool that needs Python 3.11
mamba create -n modern python=3.11 moderntool
Switch between them as needed.
Problem 3: “Command Not Found” After Activation
Cause: You’re in the wrong environment, or the tool wasn’t installed correctly.
Solution:
# Check which environment you're in
echo $CONDA_PREFIX
# List all environments
mamba env list
# Reinstall the tool
mamba install samtools --force-reinstall
Problem 4: Package Conflicts After Installation
Cause: Installing too many unrelated packages in one environment. Their dependencies conflict.
Solution: Use strict channel priority and never disable it:
conda config --set channel_priority strict
If conflicts persist, split your tools into separate environments by project phase.
Problem 5: Disk Space Bloat
Conda caches downloaded packages. Clean them up:
mamba clean --all --yes
This removes unused packages and cache files, freeing up 1–3 GB on a typical system.
If you’re running a full bioinformatics stack with multiple environments, large reference genomes, and sequencing data, your local disk fills up faster than expected. A portable SSD is a practical solution for storing large reference databases and conda environments you’re not actively using. The Samsung T7 Shield 2TB is rugged (rated IP65 for dust and water resistance, useful in busy labs), fast enough for bioinformatics work (read speeds up to 1,050 MB/s), and USB-C compatible with modern laptops and workstations. Around $130 for 2TB. Useful if you keep reference genome indexes, raw FASTQ archives, or conda pkgs/ directories off your main drive.
Problem 6: “Permission Denied” Errors on Shared Systems
Cause: HPC systems or shared servers may have conda installed in a read-only location.
Solution: Install Miniforge in a directory you own (for example, /scratch/username or a data directory):
bash Miniforge3-Linux-x86_64.sh -b -p /scratch/username/mambaforge
Then initialize:
/scratch/username/mambaforge/bin/conda init
Step 8: Best Practices for Long-Term Success
1. One environment per project.
Don’t accumulate 100 packages in one environment. Create env_projectA, env_projectB, and so on. The disk space is worth the sanity.
mamba create -n project_a python=3.11 samtools bwa
mamba create -n project_b python=3.10 fasta2vcf picard
2. Version-pin critical dependencies.
In your environment.yml, pin versions of tools that must not change:
dependencies:
- python=3.11
- samtools=1.19.2 # pinned because scripts depend on this exact version
- bwa=0.7.17 # pinned
- pandas # flexible version is fine
3. Commit environment.yml to version control.
Every project repo should have:
project/
environment.yml
analysis.py
data/
README.md
Collaborators run mamba env create -f environment.yml once, and they’re reproducible.
4. Use mamba, not conda, for all operations.
Mamba is faster and fully compatible:
mamba install samtools # not: conda install samtools
mamba update --all # not: conda update --all
mamba env create -f env.yml # not: conda env create -f env.yml
5. Keep base environment empty.
Never install packages into base. If you’re in (base) and need a tool, create a new environment:
# Wrong
(base) $ mamba install samtools
# Right
(base) $ mamba create -n analysis python=3.11 samtools
(base) $ mamba activate analysis
(analysis) $ samtools --version
Next Steps
You now have a reproducible bioinformatics environment. The natural next steps:
-
Create a project environment with the exact tools your analysis needs. Export it to
environment.ymland commit to Git. -
Learn how to use conda in containerized workflows. If you’re running on HPC clusters or want to share reproducible analyses, Docker and Singularity containers that embed your conda environment are the next level up.
-
Automate environment setup in your analysis scripts. Snakemake and Nextflow can create environments on the fly from conda/mamba specifications. This is how production bioinformatics pipelines ensure reproducibility.
-
Document your environment decisions. In your README, note why you chose specific versions: “Python 3.11 because samtools requires it” helps future collaborators understand constraints.