macOS Big Sur python3 cannot import numpy due to polyfit error

最后都变了- 提交于 2021-02-08 20:49:46

问题


update from Jan 2021: I performed a clean install of Big Sur in Jan 2021, and upgrade pip to latest version using python3 -m pip install --upgrade pip --user, and installed numpy without issues, and without the error message below.

original question from Nov 2020

I'm using macOS big sur on 2019 macbook pro. I'm able to install numpy using python3 -m pip install numpy --user. Note I do not have brew; I'm just using the python3 from the Xcode command line tools. I've seen this error reported in many other places, but they all seem to use brew.

However, when I try to import numpy as np, I get the following error messsage.

Python(488,0x11700be00) malloc: can't allocate region
:*** mach_vm_map(size=18446744071565352960, flags: 100) failed (error code=3)
Python(488,0x11700be00) malloc: *** set a breakpoint in malloc_error_break to debug
init_dgelsd failed init
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/xdavidliu/Library/Python/3.8/lib/python/site-packages/numpy/__init__.py", line 286, in <module>
    raise RuntimeError(msg)
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned

回答1:


The numpy installed by default in my question (and which caused the crash) was 1.19. I was able to use numpy with the following workaround:

python3 -m pip uninstall numpy
python3 -m pip install numpy==1.18.0 --user


来源:https://stackoverflow.com/questions/64956168/macos-big-sur-python3-cannot-import-numpy-due-to-polyfit-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!