How to set Python Interpreter to use Intel (i386) architecture

I'm using a newer Apple MacBook with their Apple ARM architecture, and this doesn't work with some of the Python packages yet (e.g. SciPy). By installing some beta-versions, it sometimes works, but sometimes not (e.g. StatsModels). In general, my solution is so far is to emulate the Intel architecture (`arch -x86_64 zsh` in Terminal) and then do the installations as normal. And this works for the virtual environment!

However, when I try to run/debug in PyCharm (i.e. not the Terminal), it seems like it expects the ARM architecture while I installed in Intel. So the question is "How to set PyCharm's interpreter to use the i386 architecture instead of the expected arm64, like I did in the Terminal?"

For completeness, this is the error I get when running the interpreter:

 

Traceback (most recent call last):
  File "/Users/my_path/forecasting/planning_unit.py", line 6, in <module>
    import pandas as pd
  File "/Users/my_path/.venv/lib/python3.9/site-packages/pandas/__init__.py", line 16, in <module>
    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 "/Users/my_path/.venv/bin/python"
  * The NumPy version is: "1.21.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/my_path/.venv/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 2): no suitable image found.  Did find:
/Users/my_path/.venv/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so: mach-o, but wrong architecture
/Users/my_path/.venv/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so: mach-o, but wrong architecture

By the way, I did check that both my Python (v3.9.6) and NumPy (v.1.21.4) installations satisfy the condition of the error, so I think the culprit is  indeed that "wrong architecture" error in the last lines.

0

Please sign in to leave a comment.