Skip to content

Instantly share code, notes, and snippets.

@mabroor
Created December 20, 2020 09:03
Show Gist options
  • Save mabroor/41e96a12052d0c4ea2e71ef62c72b981 to your computer and use it in GitHub Desktop.
Save mabroor/41e96a12052d0c4ea2e71ef62c72b981 to your computer and use it in GitHub Desktop.
pyenv issues on Big Sur

After installing Big Sur, pyenv fails with compile errors as follows:

❯ pyenv install 3.9.0
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.0.tar.xz...
-> https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz
Installing Python-3.9.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

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

Inspect or clean up the working tree at /var/folders/00/4pf4pzsx5b3_hlm4n8c24w1m0000gn/T/python-build.20201220085238.51030
Results logged to /var/folders/00/4pf4pzsx5b3_hlm4n8c24w1m0000gn/T/python-build.20201220085238.51030.log

Last 10 log lines:
  File "/private/var/folders/00/4pf4pzsx5b3_hlm4n8c24w1m0000gn/T/python-build.20201220085238.51030/Python-3.9.0/Lib/ensurepip/__init__.py", line 210, in _main
    return _bootstrap(
  File "/private/var/folders/00/4pf4pzsx5b3_hlm4n8c24w1m0000gn/T/python-build.20201220085238.51030/Python-3.9.0/Lib/ensurepip/__init__.py", line 129, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/private/var/folders/00/4pf4pzsx5b3_hlm4n8c24w1m0000gn/T/python-build.20201220085238.51030/Python-3.9.0/Lib/ensurepip/__init__.py", line 38, in _run_pip
    return subprocess.run([sys.executable, "-c", code], check=True).returncode
  File "/private/var/folders/00/4pf4pzsx5b3_hlm4n8c24w1m0000gn/T/python-build.20201220085238.51030/Python-3.9.0/Lib/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/private/var/folders/00/4pf4pzsx5b3_hlm4n8c24w1m0000gn/T/python-build.20201220085238.51030/Python-3.9.0/python.exe', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/var/folders/00/4pf4pzsx5b3_hlm4n8c24w1m0000gn/T/tmpx_tbyvpl/setuptools-49.2.1-py3-none-any.whl\', \'/var/folders/00/4pf4pzsx5b3_hlm4n8c24w1m0000gn/T/tmpx_tbyvpl/pip-20.2.3-py2.py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/var/folders/00/4pf4pzsx5b3_hlm4n8c24w1m0000gn/T/tmpx_tbyvpl\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [install] Error 1

to fix it install make sure Command line tools are installed xcode-select --install

then

export LDFLAGS="-L$(xcrun --show-sdk-path)/usr/lib"
❯ pyenv install 3.9.0
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.0.tar.xz...
-> https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz
Installing Python-3.9.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.9.0 to /Users/mabroor/.pyenv/versions/3.9.0
@mohhasbias
Copy link

Thank you. It worked.

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