Install portaudio using homebrew (or method of your choice)
brew install portaudio
create $HOME/.pydistutils.cfg using the include
and lib
directories of your portaudio install:
[build_ext]
include_dirs=/Users/jrobert1271/homebrew/Cellar/portaudio/19.20140130/include/
library_dirs=/Users/jrobert1271/homebrew/Cellar/portaudio/19.20140130/lib/
Then in your virtualenv:
pip install --allow-external pyaudio --allow-unverified pyaudio pyaudio
I tried but got the following error:
Is this something to do with Xcode installation?
Thanks.
-------- full list of error message below --------
/Users/roger/ml/env/lib/python3.7/site-packages/pip/_internal/commands/install.py:244: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
cmdoptions.check_install_build_global(options)
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Skipping wheel build for pyaudio, due to binaries being disabled for it.
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: /Users/roger/ml/env/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/nj/3sdbvf895vd9s0dtdlyw302r0000gn/T/pip-install-enh0aujj/pyaudio/setup.py'"'"'; file='"'"'/private/var/folders/nj/3sdbvf895vd9s0dtdlyw302r0000gn/T/pip-install-enh0aujj/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' build_ext -I/usr/local/include -L/usr/local/lib install --record /private/var/folders/nj/3sdbvf895vd9s0dtdlyw302r0000gn/T/pip-record-wslhmklz/install-record.txt --single-version-externally-managed --compile --install-headers /Users/roger/ml/env/bin/../include/site/python3.7/pyaudio
cwd: /private/var/folders/nj/3sdbvf895vd9s0dtdlyw302r0000gn/T/pip-install-enh0aujj/pyaudio/
Complete output (8 lines):
running build_ext
building '_portaudio' extension
creating build
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/usr/local/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.7/src/_portaudiomodule.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/roger/ml/env/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/nj/3sdbvf895vd9s0dtdlyw302r0000gn/T/pip-install-enh0aujj/pyaudio/setup.py'"'"'; file='"'"'/private/var/folders/nj/3sdbvf895vd9s0dtdlyw302r0000gn/T/pip-install-enh0aujj/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' build_ext -I/usr/local/include -L/usr/local/lib install --record /private/var/folders/nj/3sdbvf895vd9s0dtdlyw302r0000gn/T/pip-record-wslhmklz/install-record.txt --single-version-externally-managed --compile --install-headers /Users/roger/ml/env/bin/../include/site/python3.7/pyaudio Check the logs for full command output.