1

I tried installing pyaudio this way (it's probably worth noting that I'm currently using an M1 MacBook):

brew install portaudio
pip install pyaudio

and encountered this problem:

zsh: command not found: pip

Then I tried using:

python3 -m install pyaudio

and this is what happened:

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 ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-install-l9y2ss43/pyaudio_082af32b7df940b88c2b176ce46b477e/setup.py'"'"'; __file__='"'"'/private/var/folders/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-install-l9y2ss43/pyaudio_082af32b7df940b88c2b176ce46b477e/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/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-record-9sps13ds/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/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-install-l9y2ss43/pyaudio_082af32b7df940b88c2b176ce46b477e/
    Complete output (16 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
    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: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-install-l9y2ss43/pyaudio_082af32b7df940b88c2b176ce46b477e/setup.py'"'"'; __file__='"'"'/private/var/folders/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-install-l9y2ss43/pyaudio_082af32b7df940b88c2b176ce46b477e/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/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-record-9sps13ds/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.

Any idea how I could fix this and get pyaudio to be installed in my computer?

Tul AP
  • 11
  • 1
  • Does this answer your question? [when installing pyaudio, pip cannot find portaudio.h in /usr/local/include](https://stackoverflow.com/questions/33513522/when-installing-pyaudio-pip-cannot-find-portaudio-h-in-usr-local-include) – Random Davis Jul 13 '21 at 18:59

0 Answers0