asdf-python icon indicating copy to clipboard operation
asdf-python copied to clipboard

Error install Python 3.10.0 on MacOS 12.0.1 on Apple M1 Pro Max

Open supercodepoet opened this issue 4 years ago • 15 comments

python-build: use [email protected] from homebrew python-build: use readline from homebrew Downloading Python-3.10.0.tar.xz... -> https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz Installing Python-3.10.0... patching file aclocal.m4 patching file configure Hunk #5 succeeded at 10537 (offset -15 lines). python-build: use readline from homebrew python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.0.1 using python-build 2.2.0-16-ge342d847)

Inspect or clean up the working tree at /var/folders/fs/4lhkvxxs1lx43fwy38dgftq40000gn/T/python-build.20211115110731.18380 Results logged to /var/folders/fs/4lhkvxxs1lx43fwy38dgftq40000gn/T/python-build.20211115110731.18380.log

Last 10 log lines: File "/private/var/folders/fs/4lhkvxxs1lx43fwy38dgftq40000gn/T/python-build.20211115110731.18380/Python-3.10.0/Lib/runpy.py", line 146, in _get_module_details return _get_module_details(pkg_main_name, error) File "/private/var/folders/fs/4lhkvxxs1lx43fwy38dgftq40000gn/T/python-build.20211115110731.18380/Python-3.10.0/Lib/runpy.py", line 110, in _get_module_details import(pkg_name) File "/private/var/folders/fs/4lhkvxxs1lx43fwy38dgftq40000gn/T/python-build.20211115110731.18380/Python-3.10.0/Lib/ensurepip/init.py", line 4, in import subprocess File "/private/var/folders/fs/4lhkvxxs1lx43fwy38dgftq40000gn/T/python-build.20211115110731.18380/Python-3.10.0/Lib/subprocess.py", line 74, in import _posixsubprocess ModuleNotFoundError: No module named '_posixsubprocess' make: *** [install] Error 1

supercodepoet avatar Nov 15 '21 17:11 supercodepoet

Why can't asdf install a binary python package for the M1 family of processors instead of insisting on compiling from the source it pitifully fails?

hipertracker avatar Jan 03 '22 01:01 hipertracker

facing the same error, any intermediate fix/patch?

tardunge avatar Jan 06 '22 21:01 tardunge

The problem was with Homebrew for Intel which I inherited after the migration from the older laptop. The solution is to completely remove Homebrew (https://stackoverflow.com/questions/65447875/how-to-uninstall-homebrew-using-an-arm-based-mac) and install it from scratch. It should install arm64/M1 version. Then install asdf and you can install Python for M1.

hipertracker avatar Jan 07 '22 01:01 hipertracker

Thanks for helping @hipertracker. My issue was due to ARCHFLAGS env set to "uname -m", which is actually creating the problem and giving the same error. Unsetting the env var in my zshrc file fixed the problem.

tardunge avatar Jan 13 '22 07:01 tardunge

Why can't asdf install a binary python package for the M1 family of processors instead of insisting on compiling from the source it pitifully fails?

Yes this is a good question, does it have to build from source? I actually have the reverse problem, it is failing on Intel MacBook with no x86_64 symbols now found. But trying the uninstall now.

richtong avatar Jun 25 '22 18:06 richtong

For Intel MBP you can force flags with the command export ARCHFLAGS="-arch x86_64" added to ~/.zshrc file (for M1 I use export ARCHFLAGS="-arch arm64")

hipertracker avatar Jun 25 '22 21:06 hipertracker

I get a different error:

$ asdf install python 3.8.9

python-build 3.8.9 /Users/glauco/.asdf/installs/python/3.8.9
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.9.tar.xz...
-> https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tar.xz
Installing Python-3.8.9...
patching file Misc/NEWS.d/next/Build/2021-10-11-16-27-38.bpo-45405.iSfdW5.rst
patching file configure
patching file configure.ac
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.6 using python-build 2.3.5-2-g03a5d653)

Inspect or clean up the working tree at /var/folders/7s/jkzqprxx23l0_9fhm4lfmwl40000gn/T/python-build.20221014143204.17422
Results logged to /var/folders/7s/jkzqprxx23l0_9fhm4lfmwl40000gn/T/python-build.20221014143204.17422.log

Last 10 log lines:
checking size of _Bool... 1
checking size of off_t... 8
checking whether to enable large file support... no
checking size of time_t... 8
checking for pthread_t... yes
checking size of pthread_t... 8
checking size of pthread_key_t... 8
checking whether pthread_key_t is compatible with int... no
configure: error: Unexpected output of 'arch' on OSX
make: *** No targets specified and no makefile found.  Stop.

I also tried with export ARCHFLAGS="-arch arm64" but didn't work.

glaucocustodio avatar Oct 14 '22 13:10 glaucocustodio

Same issue. Python 3.9 works but not 3.8.

paul-civitas avatar Feb 15 '23 22:02 paul-civitas

This might help someone: https://glaucocustodio.github.io/2022/10/14/how-to-install-multiple-versions-of-python-on-apple-silicon-m1/

glaucocustodio avatar Feb 18 '23 15:02 glaucocustodio

Thanks for helping @hipertracker.....this fixed the issue for me (resetting the arch flag)....please remember to close all shells if you're editing your startup scripts (.zshrc, etc).

jimblair avatar Mar 13 '23 14:03 jimblair

I wasn't able to fix this issue, therefore I opted with having python 3.10.5 on my local mac and will use venv with asdf for other versions of python i need. Will continue to look for a workaround

EricaDos1 avatar Oct 23 '23 11:10 EricaDos1