classification
Title: [macOS] [python3.7] : platform.machine() returns x86_64 on ARM machine
Type: behavior Stage: resolved
Components: macOS Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, ronaldoussoren, shah.malay04
Priority: normal Keywords:

Created on 2020-12-21 14:33 by shah.malay04, last changed 2020-12-21 16:10 by ned.deily. This issue is now closed.

Messages (5)
msg383525 - (view) Author: Malay Shah (shah.malay04) Date: 2020-12-21 14:33
there is a discrepancy in platform.machine() behaviour on mac ARM:

In python2.7.16 ,  platform.machine() returns : "arm64"
In python3.7.9 , platform.machine() returns : "x86_64"
msg383528 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-12-21 15:04
How did you install python3.7?

Platform.machine() will return "x86_64" when running in Rosetta 3. That is, when python itself is an x86_64 binary.
msg383531 - (view) Author: Malay Shah (shah.malay04) Date: 2020-12-21 15:21
I downloaded it from : 
www.python.org/ftp/python/3.7.9/python-3.7.9-macosx10.9.pkg
msg383533 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-12-21 15:28
That installer contains intel (x86_64) binaries. The behaviour of platform.machine() and platform.processor() is expected, due to Rosetta the binary runs as if it is running on an Intel Mac.

There is a "universal2" installer for Python 3.9.1 which will run natively on Arm systems.  The experience with 3th-party packages ("pip install ...") might be a bit rough though: this installer variant is quite new and I expect that most packages with C extensions do not yet have binary wheels for this variant.
msg383536 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-12-21 16:10
Note also that Python 3.7 is now in the security-fix-only phase of its lifecycle meaning it no longer receives non-security bug fixes and binary installers for it will no longer be produced.  In particular, Pygthon 3.7 has not been updated for macOS 11 and Apple Silicon Macs and, as Ronald notes, it will run on Apple Silicon Macs using Rosetta 2 translation, there are some things that do not work correctly on Big Sur, like find_library functions.  If at all possible, you should upgrade to Python 3.9.1 which is supported on macOS 11 Big Sur.
History
Date User Action Args
2020-12-21 16:10:32ned.deilysetstatus: open -> closed
2020-12-21 16:10:06ned.deilysetmessages: + msg383536
2020-12-21 15:28:58ronaldoussorensetresolution: not a bug
messages: + msg383533
stage: resolved
2020-12-21 15:21:26shah.malay04setmessages: + msg383531
2020-12-21 15:04:08ronaldoussorensetmessages: + msg383528
2020-12-21 14:33:43shah.malay04create