通过Conda安装py-fort-myrmidon遇Python及GLIBC版本兼容错误
问题背景
在Mac虚拟机中执行以下命令安装py-fort-myrmidon时出现报错:
conda install -c "formicidae-tracker/label/test" py-fort-myrmidon
报错信息
UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your environment:
Specifications:
- py-fort-myrmidon -> python[version='>=3.8,<3.9.0a0']
Your python: python=3.9.0
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.The following specifications were found to be incompatible with your system:
- feature:/linux-64::__glibc==2.31=0
- feature:|@/linux-64::__glibc==2.31=0
Your installed version is: 2.31
核心问题:
- 当前环境Python 3.9.0不符合包要求的
>=3.8,<3.9.0a0(仅支持Python 3.8.x系列) - 出现矛盾的GLIBC报错——已安装版本为2.31,却被提示不兼容
解决方案
1. 解决Python版本不兼容问题
Conda不会自动降级Python小版本,需创建指定Python 3.8的独立环境:
# 创建新环境并指定Python 3.8 conda create -n myrmidon-env python=3.8 # 激活新环境 conda activate myrmidon-env # 在新环境中重新安装目标包 conda install -c "formicidae-tracker/label/test" py-fort-myrmidon
2. 解决GLIBC矛盾报错
该报错大概率是Conda依赖解析bug或包的系统适配问题,可尝试以下方法:
- 方法一:用Mamba替代Conda
Mamba的依赖解析效率更高,能处理部分Conda无法解决的兼容性问题:
# 在base环境安装Mamba conda install mamba -n base -c conda-forge # 激活已创建的myrmidon-env环境 conda activate myrmidon-env # 通过Mamba安装目标包 mamba install -c "formicidae-tracker/label/test" py-fort-myrmidon
- 方法二:添加conda-forge通道
引入conda-forge补充依赖源,可能解决系统库适配问题:
conda install -c conda-forge -c "formicidae-tracker/label/test" py-fort-myrmidon
- 方法三:跳过依赖检查(谨慎使用)
若上述方法无效,可尝试跳过依赖检查安装,之后手动补全必要依赖:
conda install -c "formicidae-tracker/label/test" py-fort-myrmidon --no-deps
内容的提问来源于stack exchange,提问作者Amaranta_Remedios

