I wanted to install the sklearn package in PyCharm. However, I always got the same error (below is an extract):
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
So I tried to Google the solution and learned that there are certain problems with Python on a M1 Mac. What I tried:
- I tried to use a solution from another stack overflow question, but I guess I wasn't smart enough to follow the steps, so it didn't really help
- I tried to follow instructions on the scikit official site, but again, I didn't understand what to do with miniforge installers:
The recently introduced macos/arm64 platform (sometimes also known as macos/aarch64) requires the open source community to upgrade the build configuration and automation to properly support it.
At the time of writing (January 2021), the only way to get a working installation of scikit-learn on this hardware is to install scikit-learn and its dependencies from the conda-forge distribution, for instance using the miniforge installers
I also tried to install the package with Miniforge. I managed to install the package in a virtual environment, but I still couldn't import sklearn to my project:
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
I also tried lots of other things I found on the Web, but nothing helped, unfortunately
I feel like I've done a lot of unnecessary stuff so far, but I'd still really like to solve this problem. My Python version is 3.10 (I also tried 3.9 in a virtual environment) and my PyCharm version is 2021.2.2