【发布时间】:2022-02-07 23:42:53
【问题描述】:
我想在 PyCharm 中安装 sklearn 包。但是,我总是遇到同样的错误(以下是摘录):
pip install scikit-learn # input
Collecting scikit-learn
Using cached scikit-learn-1.0.2.tar.gz (6.7 MB)
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [148 lines of output]
Ignoring numpy: markers 'python_version == "3.7" and platform_machine != "aarch64" and platform_system != "AIX" and platform_python_implementation != "PyPy"' don't match your environment
Collecting setuptools<60.0
Using cached setuptools-59.8.0-py3-none-any.whl (952 kB)
Collecting wheel
Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting Cython>=0.28.5
Using cached Cython-0.29.27-py2.py3-none-any.whl (983 kB)
Collecting oldest-supported-numpy
Using cached oldest_supported_numpy-2022.1.30-py3-none-any.whl (3.9 kB)
Collecting scipy>=1.1.0
Using cached scipy-1.8.0.tar.gz (38.3 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [116 lines of output]
setup.py:482: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /private/var/folders/bh/bybj2bp10dvdq7ljmr_697mw0000gn/T/pip-modern-metadata-h78sgevf'), proceeding with generating Cython sources and expanding templates
warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
raise NotFoundError(msg)
numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK libraries found. Note: Accelerate is no longer supported.
To build Scipy from sources, BLAS & LAPACK libraries need to be installed.
See site.cfg.example in the Scipy source directory and
https://docs.scipy.org/doc/scipy/reference/building/index.html for details.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
所以我尝试用谷歌搜索解决方案,并了解到 Python 在 M1 Mac 上存在某些问题。我尝试了什么:
- 我尝试使用另一个 stack overflow question 的解决方案,但我想我不够聪明,无法遵循这些步骤,所以它并没有真正帮助
- 我尝试按照 scikit official site 上的说明进行操作,但我还是不明白如何处理 miniforge 安装程序:
最近推出的 macos/arm64 平台(有时也称为 macos/aarch64) 需要开源社区升级构建 配置和自动化以正确支持它。
在撰写本文时(2021 年 1 月),获得工作的唯一方法 在此硬件上安装 scikit-learn 是为了安装 scikit-learn 及其依赖于 conda-forge 发行版, 例如使用 miniforge 安装程序
-
我还尝试使用Miniforge 安装软件包。我设法在虚拟环境中安装该软件包,但我仍然无法导入 sklearn 到我的项目:
conda list scikit-learn # input # packages in environment at /opt/homebrew/Caskroom/miniforge/base/envs/test_env: # # Name Version Build Channel scikit-learn 1.0.2 py39hef7049f_0 conda-forge -
我还尝试了很多我在网上找到的其他东西,但没有任何帮助,很遗憾
我觉得到目前为止我已经做了很多不必要的事情,但我仍然很想解决这个问题。我的 Python 版本是 3.10(我也在虚拟环境中尝试过 3.9),我的 PyCharm 版本是 2021.2.2
【问题讨论】:
标签: python scikit-learn python-import