0
votes

This is the exception generated when I try to install pyaudio using python's pip:

ERROR: Complete output from command 'd:\python\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\ds528\\AppData\\Local\\Temp\\pip-install-3g3d86u3\\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\ds528\AppData\Local\Temp\pip-record-u7rijpbk\install-record.txt' --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.7
    copying src\pyaudio.py -> build\lib.win32-3.7
    running build_ext
    building '_portaudio' extension
    creating build\temp.win32-3.7
    creating build\temp.win32-3.7\Release
    creating build\temp.win32-3.7\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:\python\include -Id:\python\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include" "-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\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.20.27508\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command "'d:\python\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\ds528\\AppData\\Local\\Temp\\pip-install-3g3d86u3\\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\ds528\AppData\Local\Temp\pip-record-u7rijpbk\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ds528\AppData\Local\Temp\pip-install-3g3d86u3\pyaudio\
1
Please, have a look at stackoverflow.com/help/reprex and describe you problem, format the code as wellPavel Anikhouski

1 Answers

0
votes

You are trying to compile pyaudio from source and on a Windows platform that often is more difficult than one would like.

The specific problem you have is that the compiler is trying to find the include file portaudio.h which you don't have because it isn't a standard Windows include file and it is apparently also not in the download package.

It's clear that the reason pip is attempting the compile, rather than doing a binary install, is that the most recent binary installs are for Python 3.6, and you have Python 3.7.

I suggest that you install Python 3.6 alongside your existing Python 3.7 so that you can get going with this module. There may be Python 3.7 bindings available in due course, and then again there may not. The PyPI page for this project hasn't been updated in over 2 years.