向已有conda环境安装fastspar时遇ResolvePackageNotFound错误求助
向已有conda环境安装fastspar时的ResolvePackageNotFound错误解决方法
问题场景
尝试向qiime_1_9_0 conda环境安装fastspar,执行命令:
conda install -c bioconda fastspar
触发ResolvePackageNotFound错误:
Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. ResolvePackageNotFound: - defaults/linux-64::natsort==3.5.0=py27_0 - defaults/linux-64::pyparsing==2.0.3=py27_0 - defaults/linux-64::qt==4.8.7=3 - defaults/linux-64::mkl==11.3.3=0 - defaults/linux-64::mysql-python==1.2.5=py27_0 - defaults/linux-64::freetype==2.5.5=1 - defaults/linux-64::fontconfig==2.11.1=6 - defaults/linux-64::numpy==1.10.4=py27_2 - defaults/linux-64::cairo==1.12.18=6 - defaults/linux-64::py2cairo==1.10.0=py27_2 - defaults/linux-64::libgfortran==3.0.0=1 - defaults/linux-64::libgcc-ng==7.2.0=hdf63c60_3 - defaults/linux-64::scipy==0.17.1=np110py27_1 - defaults/linux-64::libpng==1.6.17=0 - defaults/linux-64::libstdcxx-ng==7.2.0=hdf63c60_3 - defaults/linux-64::matplotlib==1.4.3=np110py27_2
执行conda list | grep free确认,这些包已安装但来自废弃的free通道:
conda list |grep free
输出:
cairo 1.12.18 6 https://repo.anaconda.com/pkgs/free fontconfig 2.11.1 6 https://repo.anaconda.com/pkgs/free freetype 2.5.5 1 https://repo.anaconda.com/pkgs/free gdata 2.0.18 py27_0 https://repo.anaconda.com/pkgs/free libgfortran 3.0.0 1 https://repo.continuum.io/pkgs/free libpng 1.6.17 0 https://repo.anaconda.com/pkgs/free matplotlib 1.4.3 np110py27_2 https://repo.anaconda.com/pkgs/free mkl 11.3.3 0 https://repo.anaconda.com/pkgs/free mysql-python 1.2.5 py27_0 https://repo.anaconda.com/pkgs/free natsort 3.5.0 py27_0 https://repo.anaconda.com/pkgs/free numpy 1.10.4 py27_2 https://repo.anaconda.com/pkgs/free py2cairo 1.10.0 py27_2 https://repo.anaconda.com/pkgs/free pyparsing 2.0.3 py27_0 https://repo.anaconda.com/pkgs/free qt 4.8.7 3 https://repo.anaconda.com/pkgs/free scipy 0.17.1 np110py27_1 https://repo.anaconda.com/pkgs/free
已尝试操作
添加free通道并调整配置:
conda config --add channels free conda config --set restore_free_channel true conda config --set channel_priority flexible
查看通道配置:
conda config --show channels
输出:
channels: - conda-forge - bioconda - defaults - free - biobakery
此时解决了free通道包的问题,但出现新的错误:
conda install -c bioconda fastspar
错误输出:
Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. ResolvePackageNotFound: - defaults/linux-64::libgcc-ng==7.2.0=hdf63c60_3 - defaults/linux-64::libstdcxx-ng==7.2.0=hdf63c60_3
执行conda list确认这两个包已存在但无通道标识:
conda list|grep "libgcc-ng\|libstdcxx-ng"
输出:
libgcc-ng 7.2.0 hdf63c60_3 libstdcxx-ng 7.2.0 hdf63c60_3
环境信息
conda info输出:
active environment : qiime_1_9_0 active env location : /storage-daredevil/CONDA_ENVS/qiime_1_9_0 shell level : 1 user config file : $HOME/.condarc populated config files : $HOME/.condarc /storage-daredevil/CONDA_ENVS/qiime_1_9_0/.condarc conda version : 4.11.0 conda-build version : not installed python version : 3.9.7.final.0 virtual packages : __linux=3.10.0=0 __glibc=2.17=0 __unix=0=0 __archspec=1=x86_64 base environment : /opt/miniconda (read only) conda av data dir : /opt/miniconda/etc/conda conda av metadata url : None channel URLs : https://conda.anaconda.org/conda-forge/linux-64 https://conda.anaconda.org/conda-forge/noarch https://conda.anaconda.org/bioconda/linux-64 https://conda.anaconda.org/bioconda/noarch https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://conda.anaconda.org/free/linux-64 https://conda.anaconda.org/free/noarch https://conda.anaconda.org/biobakery/linux-64 https://conda.anaconda.org/biobakery/noarch package cache : /opt/miniconda/pkgs $HOME/.conda/pkgs envs directories : /storage-daredevil/CONDA_ENVS $HOME/.conda/envs /opt/miniconda/envs platform : linux-64 user-agent : conda/4.11.0 requests/2.27.1 CPython/3.9.7 Linux/3.10.0-1160.59.1.el7.x86_64 centos/7.9.2009 glibc/2.17 UID:GID : 1060:20 netrc file : $HOME/.netrc offline mode : False
解决方法
方法1:跳过依赖检查安装
如果确认fastspar运行不依赖环境中已存在的旧版本包,可直接跳过依赖校验:
conda install -c bioconda fastspar --no-deps
安装完成后手动验证fastspar是否能正常执行。
方法2:忽略冲突包
告诉conda忽略这两个无法解析的系统级包:
conda install -c bioconda fastspar --ignore-package libgcc-ng libstdcxx-ng
方法3:重建干净环境(推荐)
由于当前环境状态混乱,最稳妥的方式是重新构建兼容环境:
- 导出当前环境包列表:
conda env export --name qiime_1_9_0 > qiime_env.yml
- 编辑
qiime_env.yml,移除libgcc-ng、libstdcxx-ng以及来自free通道的旧包,替换为conda-forge或defaults通道的兼容版本。 - 创建新环境:
conda env create -f qiime_env.yml -n qiime_1_9_0_new
- 在新环境中安装
fastspar:
conda activate qiime_1_9_0_new conda install -c bioconda fastspar
方法4:手动标记包通道(风险较高)
通过修改环境的conda元数据文件,手动标记包的来源通道:
- 进入环境的conda-meta目录:
cd /storage-daredevil/CONDA_ENVS/qiime_1_9_0/conda-meta
- 找到
libgcc-ng-7.2.0-hdf63c60_3.json和libstdcxx-ng-7.2.0-hdf63c60_3.json文件,编辑其中的channel字段为defaults:
"channel": "defaults",
- 保存文件后重新尝试安装。
内容的提问来源于stack exchange,提问作者Marco Severgnini
相关产品推荐
相关产品推荐

