1

My PC doesn't want to install PyAudio

pip install PyAudio
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: 'c:\users\lemcr\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\LEMCr\\AppData\\Local\\Temp\\pip-install-a02e_7yr\\pyaudio_110e15c18e6044c99a162c26dbed278b\\setup.py'"'"'; __file__='"'"'C:\\Users\\LEMCr\\AppData\\Local\\Temp\\pip-install-a02e_7yr\\pyaudio_110e15c18e6044c99a162c26dbed278b\\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\LEMCr\AppData\Local\Temp\pip-record-l8j78jvs\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\lemcr\appdata\local\programs\python\python38\Include\PyAudio'
         cwd: C:\Users\LEMCr\AppData\Local\Temp\pip-install-a02e_7yr\pyaudio_110e15c18e6044c99a162c26dbed278b\
    Complete output (17 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    copying src\pyaudio.py -> build\lib.win-amd64-3.8
    running build_ext
    building '_portaudio' extension
    creating build\temp.win-amd64-3.8
    creating build\temp.win-amd64-3.8\Release
    creating build\temp.win-amd64-3.8\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 -Ic:\users\lemcr\appdata\local\programs\python\python38\include -Ic:\users\lemcr\appdata\local\programs\python\python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.8\Release\src/_portaudiomodule.obj
    _portaudiomodule.c
    c:\users\lemcr\appdata\local\programs\python\python38\include\pyconfig.h(117): warning C4005: "MS_WIN64": Makro-Neudefinition
    src/_portaudiomodule.c: note: Siehe vorherige Definition von "MS_WIN64"
    src/_portaudiomodule.c(29): fatal error C1083: Datei (Include) kann nicht ge”ffnet werden: "portaudio.h": No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\lemcr\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\LEMCr\\AppData\\Local\\Temp\\pip-install-a02e_7yr\\pyaudio_110e15c18e6044c99a162c26dbed278b\\setup.py'"'"'; __file__='"'"'C:\\Users\\LEMCr\\AppData\\Local\\Temp\\pip-install-a02e_7yr\\pyaudio_110e15c18e6044c99a162c26dbed278b\\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\LEMCr\AppData\Local\Temp\pip-record-l8j78jvs\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\lemcr\appdata\local\programs\python\python38\Include\PyAudio' Check the logs for full command output.
user1987607
  • 2,057
  • 6
  • 26
  • 53
Actsy YT
  • 11
  • 3
  • This will help https://stackoverflow.com/questions/64570714/getting-error-while-pip3-install-numpy-error-command-errored-out-with-exit-stat/66868621#66868621 – Vishal Ram Apr 22 '21 at 15:13

2 Answers2

1

Your problem persists because maybe the developer of the package PyAudio hasn't updated the package. In addition to that I suggest you install some other package which possess similar operation.

For e.g. you can install pydub or simpleaudio. For installing:

python -m pip install pydub/simpleaudio

or

pip3 install pydub/simpleaudio 
pratyush
  • 11
  • 1
0

Use a precompiled wheel for windows. I recommend this site. Pyaudio wheels can be found here. Download the one corresponding to your python version and install it with:

py -m pip install name.whl

Obviously from the same directory or replace name.whl with the full path to the wheel. I also recommend you first upgrade pip and setuptools with:

py -m pip install --upgrade pip
py -m pip install --upgrade setuptools

After using pyaudio myself, I recommend using sounddevice instead.

Mathieu
  • 5,410
  • 6
  • 28
  • 55