Conda

Update conda software

conda update -n base -c defaults conda

Update environment from yaml file

conda env update -f myenv.yml
conda env update -f myenv.yml --prune  # removes dependencies not needed

Search for package versions

conda search packageName

Search for package and list dependency info

conda search packageName=<version> --info

Clean unneeded files

conda clean -tp

Run conda inside a bash script

eval "$(conda shell.bash hook)"

Channel Priority: put this in your ~/.condarc file

channels:
  - conda-forge
  - defaults

Using Conda in a script

In a Windows .bat script, use

CALL conda.bat activate <env-name>

In a bash script, use

eval "$(conda shell.bash hook)"
conda activate <env-name>

Conda Mamba Solver: Faster Environment Solver

Use the mamba solver in Conda (must be using Conda version>=22.11.0)

conda install -n base conda-libmamba-solver -c conda-forge

Then set this solver as the default

conda config --set solver libmamba

Read more about this solver here.

If you have issues, see https://github.com/conda/conda-libmamba-solver/issues/244#issuecomment-1699956540