Search code examples
pythonpyaudioportaudio

Unable to install pyAudio


Im trying to make a speech recognition program but when i try to install pyaudio, i get an error.

I have looked through a range of other posts but generally dont fix my problem or not related to what im asking.

This is the error i get in the command line when i tried to install:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\benha\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\benha\AppData\Local\Programs\Python\Python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win32-3.7\Release\src/_portaudiomodule.obj
    _portaudiomodule.c
    src/_portaudiomodule.c(29): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "C:\Users\benha\AppData\Local\Programs\Python\Python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\benha\\AppData\\Local\\Temp\\pip-install-xsomq17h\\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\benha\AppData\Local\Temp\pip-record-_rlhf6en\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\benha\AppData\Local\Temp\pip-install-xsomq17h\pyaudio\

from what I can find from this the problem is something to do with portaudio perhaps being missing? and i still dont know how to fix that either. Thanks for any support.


Solution

  • if you are using python 3.7 try to downgrade it to 3.6