I was trying to install scikit-learn with:
python3 -m pip install scikit-learn
but it failed with a ton of errors while dealing with numpy
as a dependency. Main error:
clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
https://scikit-learn.org/dev/install.html#installing-on-apple-silicon-m1-hardware
suggests using miniforge
.
- Download the correct version of
miniforge
binary fromhttps://github.com/conda-forge/miniforge
. In my case:
wget `https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
- Run:
bash Miniforge3-MacOSX-arm64.sh
- Reload your shell. You can simply open a new tab or a new terminal.
- Create a new environment with
conda
conda create --name py392
- Activate the created environment
conda activate py392
- Install the version of Python that you need within this environment
conda install -y python==3.9.2
- Install
scikit-learn
conda install -y scikit-learn