Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
supercodepoet opened this issue Nov 15, 2021 · 15 comments
Open

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

supercodepoet opened this issue Nov 15, 2021 · 15 comments

Comments

@supercodepoet
Copy link

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

@hipertracker
Copy link

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
Copy link

tardunge commented Jan 6, 2022

facing the same error, any intermediate fix/patch?

@hipertracker
Copy link

hipertracker commented Jan 7, 2022

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
Copy link

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
Copy link

richtong commented Jun 25, 2022

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
Copy link

hipertracker commented Jun 25, 2022

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
Copy link

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.

@paul-civitas
Copy link

Same issue. Python 3.9 works but not 3.8.

@glaucocustodio
Copy link

@jimblair
Copy link

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
Copy link

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
Copy link

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.

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

@josep16z
Copy link

josep16z commented Oct 3, 2024

Nothing in this thread worked for me, but I found an alternative solution.

Turns out I already had version 3.9.6 of python installed, which I believe got installed with the XCode Command Line Tools, which I in turn had previously installed when setting up my development environment. The command python is not recognized with this install—python3 is used instead. I just had to add an alias for python and pip.

Step by step:

  1. Verify whether you've got Python installed already: python3 --version.
  2. Go to your .bashrc, .zshrc, or equivalent file, and add the following:
alias python="python3"
alias pip="pip3"
  1. Now, install the asdf Python plugin with asdf install python latest, as you were doing before.
  2. And don't forget to asdf global python latest.

You've now got your "system Python"—the one installed by XCode Tools, which I recommend you leave alone—and the Python you'll actually be using, the versions of which you'll manage through asdf.

You can do which python, python --version, and asdf current to confirm that the Python you'll be using is indeed the version you want and managed by asdf.

@ppconde
Copy link

ppconde commented Nov 26, 2024

Nothing in this thread worked for me, but I found an alternative solution.

Turns out I already had version 3.9.6 of python installed, which I believe got installed with the XCode Command Line Tools, which I in turn had previously installed when setting up my development environment. The command python is not recognized with this install—python3 is used instead. I just had to add an alias for python and pip.

Step by step:

  1. Verify whether you've got Python installed already: python3 --version.
  2. Go to your .bashrc, .zshrc, or equivalent file, and add the following:
alias python="python3"
alias pip="pip3"
  1. Now, install the asdf Python plugin with asdf install python latest, as you were doing before.
  2. And don't forget to asdf global python latest.

You've now got your "system Python"—the one installed by XCode Tools, which I recommend you leave alone—and the Python you'll actually be using, the versions of which you'll manage through asdf.

You can do which python, python --version, and asdf current to confirm that the Python you'll be using is indeed the version you want and managed by asdf.

This worked for me, thanks!

@wang-zhenqi
Copy link

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.

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

I ran into the same issue today when trying to install Python 3.9.0. None of the replies above worked for me, so I did some searching in the asdf-python repo, reading the section "Use".

Two links might be useful.

  1. system dependencies. Install all the dependencies with homebrew.
  2. common build problems. You'll find there's an item explaining the same error. It says:

    The ARM64 architecture is supported since 3.8.10 and 3.9.1

Then I tried asdf install python 3.9.1 and it succeeded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests