asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
651 stars 56 forks source link

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

Open supercodepoet opened 2 years ago

supercodepoet commented 2 years ago

python-build: use openssl@1.1 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

hipertracker commented 2 years ago

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?

tardunge commented 2 years ago

facing the same error, any intermediate fix/patch?

hipertracker commented 2 years ago

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.

tardunge commented 2 years ago

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.

richtong commented 2 years ago

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.

hipertracker commented 2 years ago

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")

glaucocustodio commented 1 year ago

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 openssl@1.1 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.

paul-civitas commented 1 year ago

Same issue. Python 3.9 works but not 3.8.

glaucocustodio commented 1 year ago

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

jimblair commented 1 year ago

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).

EricaDos1 commented 10 months ago

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

mleongodinho commented 2 months ago

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 openssl@1.1 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.

Hi @glaucocustodio Could you manage to make it work? I am facing the same issue