Skip to content

Instantly share code, notes, and snippets.

@qral
Last active September 8, 2023 21:23
Show Gist options
  • Save qral/81b1ba201739d94f2ab5dc9a553f4dc0 to your computer and use it in GitHub Desktop.
Save qral/81b1ba201739d94f2ab5dc9a553f4dc0 to your computer and use it in GitHub Desktop.
Fix macos asdf install of python when pyexpat module can't be found..
CAN'T COMPILE PYTHON?
$ asdf install python 3.9.0
python-build 3.9.0 /Users/ad/.asdf/installs/python/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 10.14.6 using python-build 1.2.21-1-g943015eb)
Inspect or clean up the working tree at /var/folders/n6/f5hz9pgn41vglrycwvzt0twc0000gn/T/python-build.20201122183525.9477
Results logged to /var/folders/n6/f5hz9pgn41vglrycwvzt0twc0000gn/T/python-build.20201122183525.9477.log
...
File "/private/var/folders/n6/f5hz9pgn41vglrycwvzt0twc0000gn/T/python-build.20201122183525.9477/Python-3.9.0/Lib/xml/parsers/expat.py", line 4, in <module>
from pyexpat import *
ModuleNotFoundError: No module named 'pyexpat'
Traceback (most recent call last):
========================================
FIX (I don't have Xcode installed)
$ SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk MACOSX_DEPLOYMENT_TARGET=10.14 asdf install python 3.9.0
python-build 3.9.0 /Users/ad/.asdf/installs/python/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/ad/.asdf/installs/python/3.9.0
For Xcode it would be
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk MACOSX_DEPLOYMENT_TARGET=10.14 ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment