How to install SciPy on Apple Silicon (ARM / M1)

We Are Going To Discuss About How to install SciPy on Apple Silicon (ARM / M1). So lets Start this Python Article.

How to install SciPy on Apple Silicon (ARM / M1)

  1. How to solve How to install SciPy on Apple Silicon (ARM / M1)

    It's possible to install on regular arm64 brew python, you need to compile it yourself.
    If numpy is already installed (from wheels) you'll need to uninstall it:
    pip3 uninstall -y numpy pythran
    I had to compile numpy, which requires cython and pybind11:
    pip3 install cython pybind11
    Then numpy can be compiled:
    pip3 install --no-binary :all: --no-use-pep517 numpy
    Scipy needs pythran (this should happen after installing numpy):
    pip3 install pythran
    Then we need to compile scipy itself, it depends on fortran and BLAS/LACK:
    brew install openblas gfortran
    Tell scipy where it can find this library:
    export OPENBLAS=/opt/homebrew/opt/openblas/lib/
    Then finally compilescipy:
    pip3 install --no-binary :all: --no-use-pep517 scipy

  2. How to install SciPy on Apple Silicon (ARM / M1)

    It's possible to install on regular arm64 brew python, you need to compile it yourself.
    If numpy is already installed (from wheels) you'll need to uninstall it:
    pip3 uninstall -y numpy pythran
    I had to compile numpy, which requires cython and pybind11:
    pip3 install cython pybind11
    Then numpy can be compiled:
    pip3 install --no-binary :all: --no-use-pep517 numpy
    Scipy needs pythran (this should happen after installing numpy):
    pip3 install pythran
    Then we need to compile scipy itself, it depends on fortran and BLAS/LACK:
    brew install openblas gfortran
    Tell scipy where it can find this library:
    export OPENBLAS=/opt/homebrew/opt/openblas/lib/
    Then finally compilescipy:
    pip3 install --no-binary :all: --no-use-pep517 scipy

Solution 1

It’s possible to install on regular arm64 brew python, you need to compile it yourself.

If numpy is already installed (from wheels) you’ll need to uninstall it:

pip3 uninstall -y numpy pythran

I had to compile numpy, which requires cython and pybind11:

pip3 install cython pybind11

Then numpy can be compiled:

pip3 install --no-binary :all: --no-use-pep517 numpy

Scipy needs pythran (this should happen after installing numpy):

pip3 install pythran

Then we need to compile scipy itself, it depends on fortran and BLAS/LACK:

brew install openblas gfortran

Tell scipy where it can find this library:

export OPENBLAS=/opt/homebrew/opt/openblas/lib/

Then finally compilescipy:

pip3 install --no-binary :all: --no-use-pep517 scipy

Original Author Marijn Of This Content

Solution 2

This one worked for me after wasting hours:

pip install --pre -i https://pypi.anaconda.org/scipy-wheels-nightly/simple scipy

Original Author Jumshud Of This Content

Solution 3

This solution worked on my M1 machine with pyenv:

brew install openblas
OPENBLAS="$(brew --prefix openblas)" pip install numpy scipy

Original Author dwolfeu Of This Content

Solution 4

You can install miniforge from https://github.com/conda-forge/miniforge#miniforge3
and then install those packages with,

conda install numpy scipy matplotlib

Original Author isuruf Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment