how to build universal2 python on M1 mac using pyenv?
Asked Answered
T

0

6

I'm trying to use pyenv to build & install a universal2 (arm64+intel) python 3.10 on an M1 Mac; I'm running MacOS Monterey 12.3.1. (I need that to use pyinstaller to create universal2 builds.)

I've tried env MACOSX_DEPLOYMENT_TARGET=10.9 CONFIGURE_OPTS="--enable-shared --enable-universalsdk --with-universal=archs=universal2" pyenv install 3.10.3 which I believe is the correct way to do it, but I get this error:

  File "/private/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/python-build.20220509131706.57223/Python-3.10.2/Lib/ensurepip/__init__.py", line 193, in _bootstrap
    return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
  File "/private/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/python-build.20220509131706.57223/Python-3.10.2/Lib/ensurepip/__init__.py", line 93, in _run_pip
    return subprocess.run([sys.executable, '-W', 'ignore::DeprecationWarning',
  File "/private/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/python-build.20220509131706.57223/Python-3.10.2/Lib/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/private/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/python-build.20220509131706.57223/Python-3.10.2/python.exe', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/tmpifyf93mk/setuptools-58.1.0-py3-none-any.whl\', \'/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/tmpifyf93mk/pip-21.2.4-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/tmpifyf93mk\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' died with <Signals.SIGABRT: 6>.

I tried various 3.9 versions as well, with the same results.

I'm using homebrew pyenv, and my brew is /opt/homebrew, so M1-based.

Is there a way to use pyenv to get a universal arm/intel python on an M1 machine?

Tekla answered 9/5, 2022 at 17:33 Comment(2)
Spent a couple days on this, was not able to get a fully universal2 build out of pyenv or homebrew. Best solution I was able to find is using the binary distribution from: python.org/downloadsAbrasive
any news on this one? I would also prefer managing all my python version using pyenv...Gan

© 2022 - 2024 — McMap. All rights reserved.