Skip to content

Conda/Python in Linux

Install miniconda (python & pip included) in Linux

see more in Recommended Software for Python

1.Install miniconda

(need to repeat it for each user)

清华镜像网站安装帮助: https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

Miniconda 是一个 Anaconda 的轻量级替代,默认只包含了 python 和 conda,但是可以通过 pip 和 conda 来安装所需要的包。Miniconda 安装包可以到以下链接下载。

https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/

# step 1. download the installation script
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py310_23.11.0-2-Linux-x86_64.sh

# step 2. install
bash Miniconda3-py310_23.11.0-2-Linux-x86_64.sh

Warning

Do not install version higher than py310_23.11.0 in cnode, which is not compatible.

wget seems not working in cnode for mirrors.tuna.tsinghua.edu.cn, I downloaded the sh file in lulab_cluster, then copied it to cnode.

2. Example of pip install: mkdocs

Install mkdocs using pip (need to repeat it for each user)

See detailed instructions in mkdocs-material official site

# 1. Intall mkdocs for each user
pip install mkdocs-material

# 2. Install more plugins for each user
pip install mkdocs-glightbox mkdocs-video mkdocs-audio mkdocs-callouts mkdocs-redirects
# pip install mkdocs-encryptcontent-plugin

# 3. Setup shortcuts in ~/shortcuts for each user

3. Example of conda install: samtools

Warning

The following instuction was generated by AI. It has not been tested yet. (I think you should be able to learn more from AI than from me today.)

Installing bioinformatics software using Conda, particularly through the Bioconda channel, involves a few key steps:

  • (1) Install Conda.

If you don't already have it, install Miniconda (a lightweight version of Anaconda) or Anaconda.

  • (2) Add Bioconda and Conda-Forge channels.

These channels contain a vast collection of bioinformatics software. You can add them to your Conda configuration using:

    conda config --add channels bioconda
    conda config --add channels conda-forge
    conda config --set channel_priority strict

The channel_priority strict setting ensures that packages are preferentially installed from the highest-priority channels, reducing potential dependency conflicts.

  • (3) Create a new Conda environment (recommended).

To manage dependencies and avoid conflicts between different software, it is best practice to create a dedicated environment for each tool or project.

    conda create -n my_bioinformatics_env

Replace my_bioinformatics_env with a descriptive name for your environment. You can also specify a Python version if needed: conda create -n my_bioinformatics_env python=3.9.

  • (4) Activate the environment.
    conda activate my_bioinformatics_env
  • (5) Install the desired bioinformatics software.

Once the environment is active, you can install packages using conda install.

For example, to install samtools:

    conda install samtools

You can also install specific versions: conda install bwa=0.7.17.

  • (6) Deactivate the environment.

When you are finished using the software in an environment, you can deactivate it:

    conda deactivate

Suggested by AI:

You can also use Mamba, a faster alternative to Conda, for installing packages, especially when dealing with many dependencies. The commands are similar, replacing conda with mamba. For example: mamba install samtools.