'Wrong architecture issue on virtual environment Apple M1 Chip
I have been trying to run my django project on my new macbook Apple M1 Chip machine but only to encounter the error below. I have tried to ensure that arch command returns i386 on both pycharm and system terminal but still not working.
ImportError: dlopen(/Users/harmankibue/.virtualenvs/wwsb_env/lib/python3.9/site-packages/srsly/ujson/ujson.cpython-39-darwin.so, 2): no suitable image found. Did find:
/Users/harmankibue/.virtualenvs/wwsb_env/lib/python3.9/site-packages/srsly/ujson/ujson.cpython-39-darwin.so: mach-o, but wrong architecture
/Users/harmankibue/.virtualenvs/wwsb_env/lib/python3.9/site-packages/srsly/ujson/ujson.cpython-39-darwin.so: mach-o, but wrong architecture
Solution 1:[1]
Try this, Go to Application folder -> Right click on Terminal App -> Get Info
Tick Open with Rosetta option. build the project now.
Solution 2:[2]
I had Python 3.8.10 in my mac OS and was facing this same error after installing numpy version 1.21.x.
Reinstalling numpy with a lower version of 1.19.2 worked for me and I stopped seeing such errors.
Solution 3:[3]
Installing the Intel .dmg version of PyCharm solved this issue for me, after trying lots of ways all through the day
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rahul R |
| Solution 2 | Shubham Kumar |
| Solution 3 | Skyouth |
