Jim
Jim

Reputation: 51

Pyenv failing to build and install Python versions on MacOS - possibly incorrectly detecting OS/architecture?

I'm getting the below cryptic error when attempting to install versions of Python using Pyenv on MacOS 14.6.1. I've completely removed and reinstalled the xcode command line tools and homebrew, but still getting the same error. The only thing I can get out of this is that it's possibly not detecting the OS version/architecture correctly, given that it references a "python.exe" in the error. Attempting to install other versions of Python, such as 3.9, are giving me the same error.

I'd appreciate any help anyone could offer.

jbethune@JB-MBP ~> pyenv install 3.10
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.14.tar.xz...
-> https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tar.xz
Installing Python-3.10.14...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 14.6.1 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/fd/s_hgh6h15_920prcs17cn_qw0000gn/T/python-build.20240905225926.76590
Results logged to /var/folders/fd/s_hgh6h15_920prcs17cn_qw0000gn/T/python-build.20240905225926.76590.log

Last 10 log lines:
  File "/private/var/folders/fd/s_hgh6h15_920prcs17cn_qw0000gn/T/python-build.20240905225926.76590/Python-3.10.14/Lib/ensurepip/__init__.py", line 287, in _main
    return _bootstrap(
  File "/private/var/folders/fd/s_hgh6h15_920prcs17cn_qw0000gn/T/python-build.20240905225926.76590/Python-3.10.14/Lib/ensurepip/__init__.py", line 203, in _bootstrap
    return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
  File "/private/var/folders/fd/s_hgh6h15_920prcs17cn_qw0000gn/T/python-build.20240905225926.76590/Python-3.10.14/Lib/ensurepip/__init__.py", line 104, in _run_pip
    return subprocess.run(cmd, check=True).returncode
  File "/private/var/folders/fd/s_hgh6h15_920prcs17cn_qw0000gn/T/python-build.20240905225926.76590/Python-3.10.14/Lib/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/private/var/folders/fd/s_hgh6h15_920prcs17cn_qw0000gn/T/python-build.20240905225926.76590/Python-3.10.14/python.exe', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/var/folders/fd/s_hgh6h15_920prcs17cn_qw0000gn/T/tmp738psdmm/setuptools-65.5.0-py3-none-any.whl\', \'/var/folders/fd/s_hgh6h15_920prcs17cn_qw0000gn/T/tmp738psdmm/pip-23.0.1-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/var/folders/fd/s_hgh6h15_920prcs17cn_qw0000gn/T/tmp738psdmm\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' died with <Signals.SIGABRT: 6>.
make: *** [install] Error 1

Here's the relevant lines of Pyenv setup in my .zshrc, per the instructions in the Pyenv Github:

export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

Tried reinstalling xcode command line tools and homebrew. Tried installing different versions of Python. Reviewed the Pyenv config in .zshrc. Reviewed common build problems on Pyenv Github and none seemed relevant.

Upvotes: 4

Views: 649

Answers (1)

Benjamin Lowry
Benjamin Lowry

Reputation: 3789

I have seen this same error occur when binutils is installed via homebrew on Mac, try running brew remove binutils and retrying.

This is one of the suggested fixes listed in the common build problems, but it lists a different error than this.

Upvotes: 0

Related Questions