Skip to content

Conda

Updated by Hongjiang on 09/20/2022

Conda Docs

Anaconda Package Seach

Anaconda Tsinghua Mirror

Miniconda Tsinghua Mirror

There are two types of conda: Anaconda and Miniconda. Anaconda installs lots of packages by default, which takes longer time and occupies more space; Miniconda only installs basic packages, which can be expanded on demand.

✅ Miniconda Recommended

Conda could be installed by root or every user individually.

Conda could be used to organize python, R, C, java packages.

Download Miniconda

Download Miniconda for your system from Official Website or Tsinghua Mirror.

For example, for x86 Linux systems:

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

Using Tsinghua Mirror:

x86_64
wget https://mirror.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh
armv7l
wget https://mirror.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-armv7l.sh

Install Miniconda

Type command below and follow the prompts:

bash Miniconda3-latest-Linux-x86_64.sh

Create and Activate Environment

Conda will create base env after installation. Plz avoid installing too many packages under base.

Activate the base env:

conda activate base

Create a new env:

conda create -n $ENV_NAME

⚠️Note: All packages in the base environment will be inherited when a new env is created.

Activate the new env:

conda activate $ENV_NAME

The name in parentheses will turn to the new env.

Add Channels

Conda only has main and r channels by default.

Add Channels from Tsinghua Mirror:

# Free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
# Main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
# Conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
# Bioconda
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/

Install Packages

A basic command could be:

conda install $PACKAGE_NAME

-c could be used to specify the details of a package.