Can't import NumPy even though I installed with pip3

Viewed 1017

Here is what I get when I try to import it

>>> import numpy

Python(26024,0x11da32dc0) malloc: can't allocate region
:*** mach_vm_map(size=18446744071675105280, flags: 100) failed (error code=3)
Python(26024,0x11da32dc0) 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 "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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

Here is additional info you might want to know.

  1. I installed numpy.

    eric@Erics-MacBook-Pro ~ % pip3 install numpy

    Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (1.19.2)

  2. I recently erased oh-my-zsh but not completely so this always comes when I open terminal.

    Last login: Tue Oct 6 17:57:22 on ttys002 /Users/eric/.zshrc:source:73: no such file or directory: /Users/eric/.oh-my-zsh/oh-my-zsh.sh

If there is something you need please let me know.

1 Answers

I have encountered the exact same issue while trying to import pandas (which requires numpy). Basically Python 3.9 isn't playing nicely with numpy on macOS for some very odd reason. Downgraded to Python 3.8 and everything works perfectly: https://www.python.org/downloads/release/python-386/.

Related