M1Bigsur11.1中的numpy构建失败

我正在使用运行 Big Sur 11.1 的 MacBook m1,并且我已经安装了Xcode-commandline-tools12.3 版并且它已经安装python3.8.5并且pip3.python3 和 pip 是本机应用程序,即它们在 ARM 中运行

pip3 版本 20.3.3

python3 版本 3.8.5

setuptools 版本 51.0.0

wheel 版本 0.36.2

当我打字时 python3 -m pip install numpy

输出是:

Defaulting to user installation because normal site-packages is not writeable
Collecting numpy
  Using cached numpy-1.19.4.zip (7.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 wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: numpy
  Building wheel for numpy (PEP 517): started
sandeep@Sandeeps-Air ~ % cat a
Defaulting to user installation because normal site-packages is not writeable
Collecting numpy
  Using cached numpy-1.19.4.zip (7.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 wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: numpy
  Building wheel for numpy (PEP 517): started
  Building wheel for numpy (PEP 517): finished with status 'error'
Failed to build numpy

并且有一个非常大的错误列表

M1 仍然不支持 numpy 还是我做错了?

回答

I had exactly the same issue with my brand new Mac Mini. After spending an afternoon reading this issue on github, I finally succeeded. However, it only seems to work with v1.20.0rc2 or above...

Long story short, these were the steps I've taken to get it working:

pip3 install Cython
git clone https://github.com/numpy/numpy.git 
cd numpy
pip3 install . --no-binary :all: --no-use-pep517

After that, I could cd into my virtualenv and import numpy:

>>> import numpy as np
>>> np.__version__
'1.21.0.dev0+402.gc4ae3ce64'
>>> 

Next up: pandas.

UPDATE:
After some more searching, I found this interesting article, which states that you can easily start Terminal in Rosatta mode. That also solved the issues.

However, I am working with a headless Mac Mini, so I still have to find out whether that solution also is feasable in that particular setup.

UPDATE 2

I now have pandas working as well, thanks to this answer on SO.


回答

是的,稳定版似乎仍然不支持 numpy,但是如果您准备使用不稳定版,请尝试以下命令:

pip3 安装 numpy --compile --pre

这将从不稳定分支重新编译所有必要的代码。

为我工作。

  • This got me closer to anything else I've tried, but I still ended up with `ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly`. Aargh!
  • It worked for me. I think the issue is that you should use the default xcode cli python. The version at this time is 3.8

以上是M1Bigsur11.1中的numpy构建失败的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>