Skip to content

Instantly share code, notes, and snippets.

@costyn
Created December 6, 2021 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save costyn/f8d25d400d70485736803d2a520f0be9 to your computer and use it in GitHub Desktop.
Save costyn/f8d25d400d70485736803d2a520f0be9 to your computer and use it in GitHub Desktop.
Mac OS X Big Sur (11.4) pyaudio issues.
During pip install ledfx, the pyaudio dependency failed:
➜ ~ pip install pyaudio
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python@3.9/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xx/p5vn3_bx53916_t4ssf1ckl80000gn/T/pip-install-zstpo3wg/pyaudio_e9d5e43e49ab4a96aa64cdcde26a99b5/setup.py'"'"'; __file__='"'"'/private/var/folders/xx/p5vn3_bx53916_t4ssf1ckl80000gn/T/pip-install-zstpo3wg/pyaudio_e9d5e43e49ab4a96aa64cdcde26a99b5/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/xx/p5vn3_bx53916_t4ssf1ckl80000gn/T/pip-wheel-mw9r3_7n
cwd: /private/var/folders/xx/p5vn3_bx53916_t4ssf1ckl80000gn/T/pip-install-zstpo3wg/pyaudio_e9d5e43e49ab4a96aa64cdcde26a99b5/
Complete output (13 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-11-x86_64-3.9
copying src/pyaudio.py -> build/lib.macosx-11-x86_64-3.9
running build_ext
building '_portaudio' extension
creating build/temp.macosx-11-x86_64-3.9
creating build/temp.macosx-11-x86_64-3.9/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -DMACOSX=1 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-11-x86_64-3.9/src/_portaudiomodule.o
clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11'
error: command '/usr/bin/clang' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for pyaudio
I was just kind of annoyed and was checking obvious things like python versions; I had just upgraded my Homebrew for the nth time so was expecting things to go south.
I was googling for the wrong search terms at first, not spotting the clang error until later.
I then came across this StackOverflow post:
https://stackoverflow.com/questions/63972113/big-sur-clang-invalid-version-error-due-to-macosx-deployment-target#
I tried the suggested 'switch':
➜ ~ sudo xcode-select --switch /Library/Developer/CommandLineTools
but the clang version didn't change:
➜ ~ clang --version
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I then deleted the XCode commandline tools:
➜ ~ sudo rm -rf /Library/Developer/CommandLineTools
And reinstalled it:
➜ ~ sudo xcode-select --install
xcode-select: note: install requested for command line developer tools
This takes quite a while (to download and install, 20 mins); opens a GUI
Now checking my clang version again:
➜ ~ clang --version
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
And now the pyaudio and ledfx installs went off without a hitch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment