Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)
edited by

When I was trying to install pyaudio. It suddenly threw me an error telling.

Collecting pyaudio

  Using cached PyAudio-0.2.11.tar.gz (37 kB)

Installing collected packages: pyaudio

    Running setup.py install for pyaudio ... error

    ERROR: Command errored out with exit status 1:

     command: 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\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 'C:\Users\mayank\AppData\Local\Temp\pip-record-s8qn1fa4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\Include\pyaudio'

         cwd: C:\Users\mayank\AppData\Local\Temp\pip-install-b1kw0ltr\pyaudio\

The complete error is :

   running install

    running build

    running build_py

    creating build

    creating build\lib.win32-3.8

    copying src\pyaudio.py -> build\lib.win32-3.8

    running build_ext

    building '_portaudio' extension

    creating build\temp.win32-3.8

    creating build\temp.win32-3.8\Release

    creating build\temp.win32-3.8\Release\src

    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\mayank\AppData\Local\Programs\Python\Python38-32\include -IC:\Users\mayank\AppData\Local\Programs\Python\Python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\include" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win32-3.8\Release\src/_portaudiomodule.obj

    _portaudiomodule.c

    src/_portaudiomodule.c(27): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory

    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

    ----------------------------------------

ERROR: Command errored out with exit status 1: 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\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 'C:\Users\mayank\AppData\Local\Temp\pip-record-s8qn1fa4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\Include\pyaudio' Check the logs for full command output.

1 Answer

0 votes
by (36.8k points)

You can use the command to install :

brew install portaudio

Then use the command:

brew link portaudio

pip install pyAudio

If you are using windows then click on the link below:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

and download the file. Go to the directory and click on cmd then type the below command if 32 bit :

pip install PyAudio‑0.2.11‑cp37‑cp37m‑win32.whl 

For 64 bit:

pip install PyAudio‑0.2.11‑cp38‑cp38‑win_amd64.whl

I hope this will help you.

Learn Python for Data Science Course to improve your technical knowledge.

Browse Categories

...