238-conda新安装的软件运行报错,怎么办?

刘小泽写于2021.3.12

conda出现以后,我们安装软件就不需要再折腾了,省了大量的时间。相信看到推送的你,对于conda也不再陌生。但今天遇到一个问题,需要注意一下

安装bowtie2成功却运行失败

报错信息如下:

$ conda create -n test -c bioconda bowtie2 -y
$ conda activate test
$ bowtie2
~/.conda/envs/test/bin/bowtie2-align-s: error while loading shared libraries: libtbb.so.2: cannot open shared object file: No such file or directory
(ERR): Description of arguments failed!
Exiting now ...

本来以为是安装的bowtie2版本太新,结果切换一个旧版本还是不行

然后搜索看到有人也遇到了一样的问题:https://www.biostars.org/p/494922/

他给出的解决方案是:

$ conda install tbb=2020.2 -y
# 此时就可以正常运行
$ bowtie2 -h

安装samtools成功却运行失败

报错信息是:

samtools: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory

在https://github.com/bioconda/bioconda-recipes/issues/12100搜索的解决方案是:

conda install openssl=1.0 -y

小结

虽然现在软件安装方便了许多,但还是存在一些隐藏的bug(尤其是软件新版本)以及动态链接库的问题

一般可以考虑:

  • 降低软件版本(指定安装某个稳定的版本)
  • 搜索conda安装动态库

最后,再放上conda几个常用的操作

# 清华源:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --set show_channel_urls yes

# 北外源:
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

# 修改为官方源:
conda config --remove-key channels
conda config --add channels r 
conda config --add channels conda-forge 
conda config --add channels bioconda

# 指定搜某个版本
conda install samtools=1.8 -y
#删除一个环境中某个软件
conda remove -n test samtools -y
#删除整个环境
conda remove  -n test --all
#或者直接 rm -rf $HOME/miniconda3/envs/test/

# conda强迫症选项(隐藏base)
conda config --set auto_activate_base False
Yunze Liu
Yunze Liu
Bioinformatics Sharer

Co-founder of Bioinfoplanet(生信星球)

Next
Previous

Related