Install Pandas for python on Apple M1 silicon devices.
I am using pandas/numpy for some basic ML/DL applications. However, moving to the M1 chip makes setting up pandas/numpy a little bit trickier.
I was using Pycharm’s automatic installation, which did not work while giving me the following error:
Normally, it means numpy can’t be installed/built using PEP517 and you can probably circumvent that with a no-pep517 option.
However, this is a different story on the M1 chip because although many python packages support both ARM64 and X86 architectures, some of them still are not supported yet.
Naturally, I tried to use my file absolute path python -m pip install pandas.
“/Users/myusername/venv/bin/python -m pip install pandas” to install the packages.
However, when I run my script there were still errors relating to “wrong architecture”. This is due to the fact that I use the M1 silicon chip version of Pycharm instead of the Intel version of Pycharm while I installed a x86 architecture aversion of the pandas package on my computer.
The solution is rather simple.
First, install Rosetta translator via:
You then need to download “ITerm”, which is a terminal substitute for OSX.
Once you installed ITerm, go to its “Get info” and check the box for “ Open Using Rosetta”, this makes every command you execute inside it an “x86 architecture” command.
Then just execute the usual command to install pandas. In my case,
““/Users/myusername/venv/bin/python -m pip install pandas”.
The last crucial step is to use the right version of Pycharm, go to Pycharm’s official website download package, and select the Intel.dmg to download and install. This ensures all codes interpreted and run are also in an x86 environment instead of ARM64 since the Intel version of Pycharm will also be translated using Rosetta 2 first.
Voila, now you can run Pandas/Numpy applications with Pycharm with any M1 chip devices.