Introduction
Conda has been revolutionary for scientific software. For developers it has made it simpler to package their tools. HPC users have been empowered to deploy software without relying on the cluster administrators to build new modules. For desktop users it has made it simple to get the tools they need installed without the pain of the "./configure && make && make install" cycle.
For those of us in the bioinformatics field, Bioconda has done an amazing job in wrangling the huge number of tools endlessly being published and updated into a (mostly) seamless installtion process. However, things do go wrong occasionally. Sometimes is the fault of Conda or Bioconda, but sometimes it's just a mangled installation which is best handled by a "nuke and rebuild" strategy. This post will show you how to do it properly.
1. Seek
Firt we need to find where you installed conda previously. Normally this will be ~/miniconda3 in your home folder. You can determine via one of the methods below.
% conda activate base % echo $CONDA_PREFIX /home/tseemann/miniconda3 % whch conda ~/miniconda/bin/conda
2. Destroy
% conda deactivate % rm -f ~/.condarc % rm -fr ~/.conda # replace this folder if needed from Step 1 % rm -fr ~/miniconda3
3. Rebuild
% cd $HOME # donwload the installer % curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh # add "-b" if you want to skip all the questions % sh ./Miniconda3-latest-Linux-x86_64.sh
4. Get your channels in order
This is a very important step that many users don't do. The order is critical to avoid weird dependency failures later.
% conda config --add channels defaults % conda config --add channels bioconda % conda config --add channels conda-forge
5. Install mamba
The conda command can often take
a very long time to resolve dependencies.
An alternative is mamba
which is a (mostly) drop in replacement
for the conda command which
is much faster.
% conda install mamba -y % mamba --version mamba 0.15.3 conda 4.12.0
6. Use mamba of conda for installs
% mamba create -n torsryverse 'snppy==4.4.5' shovill abricate mlst prokka % conda activate torstyverse % snippy --version snippy 4.4.5
7. Add aliases
I personally get tired of typing out conda activate and conda deactivate so I have aliases for them.
# Append to ~/.bashrc login file % echo "alias ca='conda activate'" >> ~/.bashrc % echo "alias cda='conda deactivate'" >> ~/.bashrc # log out and log back in % ca torstyserse % mlst --version mlst 2.22.0
Conclusion
Sometimes it is just better to burn it all down and start again.