Ubuntu 24.04下conda/pip安装auto-sklearn失败及TPOT导入问题求助
问题:Ubuntu 24.04及Windows下auto-sklearn安装失败,TPOT安装成功但无法导入
环境说明
- 当前使用系统:Ubuntu 24.04
- Windows系统下也遇到相同的auto-sklearn安装问题
- TPOT已安装成功,但无法正常导入
pip安装auto-sklearn时的错误信息
File "<string>", line 293, in setup_package ModuleNotFoundError: No module named 'numpy.distutils' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.
conda安装auto-sklearn时的错误信息
conda install conda-forge::auto-sklearn Channels: - defaults - conda-forge 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 auto-sklearn-0.12.5-pyhd8ed1ab_0 requires pyrfr >=0.8.1,<0.9, but none of the providers can be installed Could not solve for environment specs The following packages are incompatible ├─ auto-sklearn is installable and it requires │ └─ pyrfr >=0.8.1,<0.9 with the potential options │ ├─ pyrfr [0.8.1|0.8.2] would require │ │ └─ python >=3.6,<3.7.0a0 , which can be installed; │ ├─ pyrfr [0.8.1|0.8.2|0.8.3] would require │ │ └─ python >=3.7,<3.8.0a0 , which can be installed; │ ├─ pyrfr [0.8.1|0.8.2|0.8.3] would require │ │ └─ python >=3.8,<3.9.0a0 , which can be installed; │ ├─ pyrfr [0.8.1|0.8.2|0.8.3] would require │ │ └─ python >=3.9,<3.10.0a0 , which can be installed; │ ├─ pyrfr [0.8.2|0.8.3] would require │ │ └─ python >=3.10,<3.11.0a0 , which can be installed; │ └─ pyrfr 0.8.3 would require │ └─ python >=3.11,<3.12.0a0 , which can be installed; └─ pin-1 is not installable because it requires └─ python 3.12.* , which conflicts with any installable versions previously reported.
解决方法
修复pip安装的numpy.distutils缺失问题
- 安装保留
numpy.distutils的旧版numpy:
pip install numpy==1.23.5
- 重新安装auto-sklearn:
pip install auto-sklearn
解决conda安装的Python版本冲突
Ubuntu 24.04默认Python为3.12,但auto-sklearn 0.12.5依赖的pyrfr最高仅支持Python 3.11,需创建指定版本的conda环境:
- 创建并激活Python 3.11环境:
conda create -n autosklearn_env python=3.11 conda activate autosklearn_env
- 在该环境内安装auto-sklearn:
conda install -c conda-forge auto-sklearn
修复TPOT无法导入的问题
TPOT安装成功但无法导入多为依赖版本不兼容,建议在上述conda环境中重新安装:
conda install -c conda-forge tpot
或通过pip安装兼容版本:
pip install tpot==0.12.1
内容的提问来源于stack exchange,提问作者Tom Tom
相关产品推荐
相关产品推荐

