Conda cheatsheet

useful conda commands
cheatsheet
Published

June 2, 2022

What is the conda environment?

conda environment is useful because you can build your own environment without meeting the situation some packages indepencies are conflict with those of another.

First of all, you need to install Anaconda or Miniconda. please refer to this link, download the installer and install Anaconda or Miniconda.

conda commands

check conda environment

conda env list

conda build a new environment

conda create -c conda-forge your_env_name

conda enter into or leave a specific environment

Enter:

conda activate your_env_name

Exit:

source deactivate

or

conda deactivate

about packages in the environment

To check all available packages:

conda list

conda list -n your_env_name

To check one package (e.g. rdkit) in your conda list

conda list | grep rdkit

export environment as yml

conda env export > environment.yml

create environment based on yml link:

conda env create -f environment.yml

update conda environment after making edits on yml file:

conda env update -f environment.yml

clone an environment

conda create -n python36 –clone python36_new

conda remove a specific environment

conda remove -n your_env_name –all

conda remove a package from a environment

conda remove –name $your_env_name $package_name

change download source of conda

  1. check download resources

conda config –set show_channel_urls yes

  1. add download sources to conda config

conda config –add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

Also you will see the infomation in file ~/.condarc

pip download sources are changed by looking at the file: ~/.pip/pip.conf