(Similar questions I have found on StackOverflow are answered for a different OS)
I'm facing some issues using numpy in my new macbook (os Big Sur).
I've used pip3 to install numpy etc but it only seems to work inside VSCode.
pip3 install numpy
Inside VSCode everything runs smoothly, even the ipynbs.
But whenever I try to run numpy using either a terminal or Jupyter notebook
import numpy as np
I'm getting the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
~/Library/Python/3.8/lib/python/site-packages/numpy/core/__init__.py in <module>
21 try:
---> 22 from . import multiarray
23 except ImportError as exc:
~/Library/Python/3.8/lib/python/site-packages/numpy/core/multiarray.py in <module>
11
---> 12 from . import overrides
13 from . import _multiarray_umath
~/Library/Python/3.8/lib/python/site-packages/numpy/core/overrides.py in <module>
6
----> 7 from numpy.core._multiarray_umath import (
8 add_docstring, implement_array_function, _get_implementing_args)
ImportError: dlopen(/Users/ahsantarique/Library/Python/3.8/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-38-darwin.so, 2): no suitable image found. Did find:
/Users/ahsantarique/Library/Python/3.8/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-38-darwin.so: mach-o, but wrong architecture
/Users/ahsantarique/Library/Python/3.8/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-38-darwin.so: mach-o, but wrong architecture
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-2-0aa0b027fcb6> in <module>
----> 1 import numpy as np
~/Library/Python/3.8/lib/python/site-packages/numpy/__init__.py in <module>
138 from . import _distributor_init
139
--> 140 from . import core
141 from .core import *
142 from . import compat
~/Library/Python/3.8/lib/python/site-packages/numpy/core/__init__.py in <module>
46 """ % (sys.version_info[0], sys.version_info[1], sys.executable,
47 __version__, exc)
---> 48 raise ImportError(msg)
49 finally:
50 for envkey in env_added:
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "/Library/Developer/CommandLineTools/usr/bin/python3"
* The NumPy version is: "1.19.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: dlopen(/Users/**/Library/Python/3.8/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-38-darwin.so, 2): no suitable image found. Did find:
/Users/**/Library/Python/3.8/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-38-darwin.so: mach-o, but wrong architecture
/Users/**/Library/Python/3.8/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-38-darwin.so: mach-o, but wrong architecture

