CentOS7.9新Anaconda3环境安装Geopandas遇UnsatisfiableError求助
问题场景
CentOS 7.9系统,新安装Anaconda3(conda 4.13.0),执行conda install geopandas时触发UnsatisfiableError,核心冲突是系统自带的glibc 2.17与geopandas依赖的高版本libgcc-ng不兼容。具体报错如下:
$conda install geopandas
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.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment:
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort. failedUnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versionsThe following specifications were found to be incompatible with your system:
- feature:/linux-64::__glibc==2.17=0
- python=3.9 -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
Your installed version is: 2.17
可行解决方案
创建低Python版本的虚拟环境
CentOS7的glibc 2.17无法满足Python3.9依赖的高版本libgcc-ng,切换到Python3.8或3.7版本可规避冲突:- 创建虚拟环境:
conda create -n geo_env python=3.8 - 激活环境:
conda activate geo_env - 安装geopandas:
conda install geopandas
- 创建虚拟环境:
使用conda-forge源安装兼容版本
conda-forge源提供更多兼容旧系统的包版本,指定与glibc2.17匹配的geopandas版本:- 添加conda-forge通道并设置优先级:
conda config --add channels conda-forge conda config --set channel_priority strict - 安装兼容版本:
conda install geopandas=0.10.2
- 添加conda-forge通道并设置优先级:
混合conda+pip安装
先用conda安装兼容的底层依赖,再用pip安装geopandas:- 安装基础依赖:
conda install gdal=3.0.4 shapely=1.7.1 fiona=1.8.20 pyproj=3.0.1 - pip安装geopandas:
pip install geopandas
- 安装基础依赖:
内容的提问来源于stack exchange,提问作者ebeb

