pyaudio installation error ( #include <stdio.h> command 'clang' failed with exit status 1)

Viewed 218

I'm trying to install pyaudio in mac having python 64 bit, using the command "pip3 install pyaudio", by getting the below error.

Installing collected packages: pyaudio
        Running setup.py install for pyaudio ... error
        ERROR: Command errored out with exit status 1:
         command: '/Users/sambitkumar/Documents/Learn/Python Packages/speech/venv/bin/python3' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kr/jr2wrc015pz1clvbqvwr1lhh0000gn/T/pip-install-sq4k9xkw/pyaudio/setup.py'"'"'; __file__='"'"'/private/var/folders/kr/jr2wrc015pz1clvbqvwr1lhh0000gn/T/pip-install-sq4k9xkw/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/kr/jr2wrc015pz1clvbqvwr1lhh0000gn/T/pip-record-0v8uniq2/install-record.txt --single-version-externally-managed --compile --install-headers '/Users/sambitkumar/Documents/Learn/Python Packages/speech/venv/include/site/python3.7/pyaudio'
             cwd: /private/var/folders/kr/jr2wrc015pz1clvbqvwr1lhh0000gn/T/pip-install-sq4k9xkw/pyaudio/
        Complete output (16 lines):
        running install
        running build
        running build_py
        creating build
        creating build/lib.macosx-10.15-x86_64-3.7
        copying src/pyaudio.py -> build/lib.macosx-10.15-x86_64-3.7
        running build_ext
        building '_portaudio' extension
        creating build/temp.macosx-10.15-x86_64-3.7
        creating build/temp.macosx-10.15-x86_64-3.7/src
        clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DMACOSX=1 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/Users/sambitkumar/Documents/Learn/Python Packages/speech/venv/include -I/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/_portaudiomodule.c -o build/temp.macosx-10.15-x86_64-3.7/src/_portaudiomodule.o
        src/_portaudiomodule.c:27:10: fatal error: 'stdio.h' file not found
        #include <stdio.h>
                 ^~~~~~~~~
        1 error generated.
        error: command 'clang' failed with exit status 1
        ----------------------------------------
    ERROR: Command errored out with exit status 1: '/Users/sambitkumar/Documents/Learn/Python Packages/speech/venv/bin/python3' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kr/jr2wrc015pz1clvbqvwr1lhh0000gn/T/pip-install-sq4k9xkw/pyaudio/setup.py'"'"'; __file__='"'"'/private/var/folders/kr/jr2wrc015pz1clvbqvwr1lhh0000gn/T/pip-install-sq4k9xkw/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/kr/jr2wrc015pz1clvbqvwr1lhh0000gn/T/pip-record-0v8uniq2/install-record.txt --single-version-externally-managed --compile --install-headers '/Users/sambitkumar/Documents/Learn/Python Packages/speech/venv/include/site/python3.7/pyaudio' Check the logs for full command output.

I tried the below solutions but none of them could help me in installing the package successfully.

  1. brew install portaudio (It's already installed)
  2. pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio (same error as mentioned above)
  3. xcode-select --install (It fails saying this is either already installed or not required any more.)

Any suggestion to install the package successfully?

0 Answers
Related