I am having a strange error on my MacBook Air (M1, 2020) where python3.8 is being installed as a 64 bit binary from homebrew brew install python@3.8
and yet, is being run in 32 bit mode, thus causing errors when trying to download packages.
Here is what I have tried:
- Reinstalling and confirming that the executable is running in 32 bit
$ brew reinstall python@3.8 #installs to /opt/homebrew/opt/python@3.8/bin/python3
$ python3.8 -c 'import sys;print("%x" % sys.maxsize, sys.maxsize > 2**64)'
> 7fffffffffffffff False
- Looking at architecture of binary
$ file /opt/homebrew/opt/python@3.8/bin/python3
> /opt/homebrew/opt/python@3.8/bin/python3: Mach-O 64-bit executable arm64
From the above output, one can see that the executable is in fact 64-bit despite being run in 32 bit mode.
- Additional installation of Rosetta 2, a mac update supposedly to fix this problem
$ /usr/sbin/softwareupdate --install-rosetta --agree-to-license
- Attempt to force binary in 64 bit arch
$ arch -x86_64 /opt/homebrew/opt/python@3.8/bin/python3
> arch: posix_spawnp: /opt/homebrew/opt/python@3.8/bin/python3: Bad CPU type in executable
Here is relevant, but sadly unhelpful for my needs, stack overflow tickets:
How to force using 64 bit python on Mac-os-X
Installation issue with Tensorflow Package
How to determine if python is in 32 or 64 bit mode mac
Bad CPU type in executable Mac Rosetta 2 Instructions
Any ideas would be helpful, thanks!