Pip is trying to build numpy instead of taking pre-built versions on M1 Mac

Viewed 892

I have an M1 mac where I was trying to do some workarounds to install numpy from a build. I wasn't able to get any to work but now I'm trying to do a "standard install" while running a terminal using Rosetta.

When I do so the output looks like the following

MacBook-Pro ~ pip install numpy                
Collecting numpy
  Using cached numpy-1.20.1.zip (7.8 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: numpy
  Building wheel for numpy (PEP 517) ... error

After this is a bunch of output where it ultimately fails to build. I don't want it to try and build but want it to take the pre-built installs that are ready to go. I'm sure I did some configuration somewhere that is causing this but is there any way to undo it?

Another thing I don't quite understand is that I've nuked the pip cache so I don't even know where it's getting this "cached numpy" from

I know I'm using the right architecture given the following

MacBook-Pro ~ uname -m                              
x86_64

UPDATE Also tried running to force to only use binary with the following, still with no luck

MacBook-Pro ~/Downloads pip install numpy --only-binary=:
all:
ERROR: Could not find a version that satisfies the requirement numpy
ERROR: No matching distribution found for numpy

Adding version info as FYI

MacBook-Pro  ~  python --version                1 ↵  py3
Python 3.9.1
MacBook-Pro  ~  pip --version                     ✔  py3
pip 21.0.1 from /Users/<>/py3/lib/python3.9/site-packages/pip (python 3.9)

I'll also note that I'm using a venv and that my python install was installed with the native ARM homebrew version

3 Answers

It is finding your cached source numpy package (as opposed to binary wheel).

You can:

  1. Delete it from the cache. or
  2. Explicitely install with --only-binary which will force pip to download a binary wheel.

This warked for me on my M1, using pip from python 3.92 virtualenv:

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

It avoids the pep517 problematic build

I won't call this THE answer but an answer I've gotten to work is the Anaconda Navigator

It has a visual installer that worked out of the box on an M1 mac. Additionally, when I used the navigator to kick off a terminal with ipython activated, the commands given worked and the resulting environment had numpy and pandas working.

Still looking for a proper native M1 solution

Related