Error installing pyaudio from PyCharm on OSX
I get an error when trying to install this package on OSX through PyCharm. Couldn't find a solution, hopefully someone here has some advice.
Collecting PyAudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Using legacy 'setup.py install' for PyAudio, since package 'wheel' is not installed.
Installing collected packages: PyAudio
Running setup.py install for PyAudio: started
Running setup.py install for PyAudio: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-install-mgmh8bxy/pyaudio_b6de439398d54d48abcfffdaaf01cc38/setup.py'"'"'; __file__='"'"'/private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-install-mgmh8bxy/pyaudio_b6de439398d54d48abcfffdaaf01cc38/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'"'"'))' install --record /private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-record-j0kk4n9l/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/PyAudio
cwd: /private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-install-mgmh8bxy/pyaudio_b6de439398d54d48abcfffdaaf01cc38/
Complete output (18 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.9
copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.9
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-x86_64-3.9
creating build/temp.macosx-10.9-x86_64-3.9/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.9/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-install-mgmh8bxy/pyaudio_b6de439398d54d48abcfffdaaf01cc38/setup.py'"'"'; __file__='"'"'/private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-install-mgmh8bxy/pyaudio_b6de439398d54d48abcfffdaaf01cc38/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'"'"'))' install --record /private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-record-j0kk4n9l/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/PyAudio Check the logs for full command output.
WARNING: You are using pip version 21.1.3; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python3.9 -m pip install --upgrade pip' command.
The same error occurs with Omnizart :(
The last PyAudio
release was in 2017, it doesn't have wheels for Python 3.9 which means no easy installation process for you - one has to compile C code on the local machine. Unfortunately, the compiling process fails as you have missing dependencies namely portaudio
. You need to install it, see the relevant question when installing pyaudio, pip cannot find portaudio.h in /usr/local/include.
Speaking of omnizart
- not sure which error do you get, I pretty much doubt it is about portaudio
. To start with - make sure to install all the dependencies as suggested in omnizart
repo: https://github.com/Music-and-Culture-Technology-Lab/omnizart/issues/29#issuecomment-877557801.