Ubuntu下Conda环境安装pyfftw时环境求解失败求助
问题
尝试从conda-forge渠道在Conda环境中安装pyfftw,执行命令conda install -c conda-forge pyfftw后,出现如下错误:
Channels: - conda-forge - defaults Platform: linux-64 Collecting package metadata (repodata.json): done Solving environment: \ warning libmamba Added empty dependency for problem type SOLVER_RULE_UPDATE failed LibMambaUnsatisfiableError: Encountered problems while solving: - package _openmp_mutex-5.1-1_gnu requires _libgcc_mutex 0.1 main, but none of the providers can be installed Could not solve for environment specs The following packages are incompatible ├─ _openmp_mutex 5.1.* is installable and it requires │ └─ _libgcc_mutex 0.1 main, which can be installed; ├─ pin-1 is installable and it requires │ └─ python 3.11.* , which can be installed; └─ pyfftw is not installable because there are no viable options ├─ pyfftw [0.10.1|0.10.3|...|0.12.0] would require │ └─ python [2.7* |>=2.7,<2.8.0a0 ], which conflicts with any installable versions previously reported; ├─ pyfftw [0.10.1|0.10.3|0.10.4] would require │ └─ python 3.4* , which conflicts with any installable versions previously reported; ├─ pyfftw [0.10.1|0.10.3|0.10.4] would require │ └─ python [3.5* |>=3.5,<3.6.0a0 ], which conflicts with any installable versions previously reported; ├─ pyfftw 0.10.4 would require │ └─ python 3.6* , which conflicts with any installable versions previously reported; ├─ pyfftw [0.10.4|0.11.0|0.11.1|0.12.0] would require │ └─ python >=3.6,<3.7.0a0 , which conflicts with any installable versions previously reported; ├─ pyfftw [0.10.4|0.11.0|0.11.1|0.12.0|0.13.0] would require │ └─ python >=3.7,<3.8.0a0 , which conflicts with any installable versions previously reported; ├─ pyfftw [0.11.1|0.12.0|0.13.0|0.13.1] would require │ └─ python >=3.8,<3.9.0a0 , which conflicts with any installable versions previously reported; ├─ pyfftw [0.12.0|0.13.0|0.13.1] would require │ └─ python >=3.10,<3.11.0a0 , which conflicts with any installable versions previously reported; ├─ pyfftw [0.12.0|0.13.0|0.13.1] would require │ └─ python >=3.9,<3.10.0a0 , which conflicts with any installable versions previously reported; └─ pyfftw [0.13.0|0.13.1] would require └─ libgcc-ng >=12 , which requires └─ _libgcc_mutex 0.1 conda_forge, which conflicts with any installable versions previously reported. Pins seem to be involved in the conflict. Currently pinned specs: - python 3.11.* (labeled as 'pin-1')
并非需要多个Python版本,核心是两个冲突点:
- 当前环境固定了Python 3.11,conda-forge上支持该版本的pyfftw(0.13.0/0.13.1)依赖
libgcc-ng >=12,而这个库需要conda-forge渠道的_libgcc_mutex 0.1; - 环境中已有的
_openmp_mutex-5.1-1_gnu依赖defaults渠道的_libgcc_mutex 0.1,两个渠道的_libgcc_mutex无法共存,导致依赖链断裂。
解决办法
方法1:创建全新conda环境(推荐)
直接基于conda-forge渠道创建仅包含Python 3.11和pyfftw的环境,彻底避免跨渠道冲突:conda create -n pyfftw_env -c conda-forge python=3.11 pyfftw创建完成后激活环境:
conda activate pyfftw_env方法2:统一渠道优先级
修改conda配置,让conda-forge渠道优先级高于defaults,强制优先使用conda-forge的包:- 打开conda配置编辑器:
conda config --edit - 在配置中添加或修改以下内容:
channel_priority: strict channels: - conda-forge - defaults - 保存退出后,重新执行安装命令:
conda install pyfftw
- 打开conda配置编辑器:
方法3:降级Python版本
选择pyfftw支持且无渠道冲突的Python版本(如3.10),先降级Python再安装:conda install python=3.10 conda install -c conda-forge pyfftw
内容的提问来源于stack exchange,提问作者SKR
相关产品推荐
相关产品推荐

