Home > Software design >  How to install pandas and numpy on Apple M2
How to install pandas and numpy on Apple M2

Time:08-19

Running code that worked well on my 2019 Mac book air, I face issues with my new M2 Mac book pro. The problem is related to Numpy and Pandas. How can I get them to work on M2.

The error code is

Traceback (most recent call last): File "/Users/wolfgangseidel/Documents/HF_Project/Hike_Radar.py", line 3, in import pandas as pd File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/init.py", line 16, in raise ImportError( ImportError: Unable to import required dependencies: numpy:

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.9 from "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9"
  • The NumPy version is: "1.20.1"

and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help.

Original error was: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 0x0002): tried: '/Applications/Python 3.9/IDLE.app/Contents/Frameworks/_multiarray_umath.cpython-39-darwin.so' (no such file), '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

CodePudding user response:

You need to open the prompt of python and type the following code

pip install pandas
pip install numpy

CodePudding user response:

Running code that worked well on my 2019 Mac book air, I face issues with my new M2 Mac book pro. The problem is related to Numpy and Pandas. How can I get them to work on M2

  • Related