0

Trying to install PyAudio using command pip install pyaudio but failed with the following error message:

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\aryat\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\aryat\\AppData\\Local\\Temp\\pip-install-wz3bueat\\PyAudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\aryat\\AppData\\Local\\Temp\\pip-install-wz3bueat\\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\aryat\AppData\Local\Temp\pip-record-o91_9x1y\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\aryat\appdata\local\programs\python\python38-32\Include\PyAudio'
         cwd: C:\Users\aryat\AppData\Local\Temp\pip-install-wz3bueat\PyAudio\
    Complete output (13 lines):
    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
    cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\aryat\appdata\local\programs\python\python38-32\include -Ic:\users\aryat\appdata\local\programs\python\python38-32\include "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win32-3.8\Release\src/_portaudiomodule.obj
    error: command 'cl.exe' failed: No such file or directory
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\aryat\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\aryat\\AppData\\Local\\Temp\\pip-install-wz3bueat\\PyAudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\aryat\\AppData\\Local\\Temp\\pip-install-wz3bueat\\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\aryat\AppData\Local\Temp\pip-record-o91_9x1y\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\aryat\appdata\local\programs\python\python38-32\Include\PyAudio' Check the logs for full command output.
Angus
  • 3,680
  • 1
  • 12
  • 27
  • https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio download from here and install with pip – Balakrishnan Apr 04 '20 at 06:34
  • Does this answer your question? [python pip on Windows - command 'cl.exe' failed](https://stackoverflow.com/questions/41724445/python-pip-on-windows-command-cl-exe-failed) – Mr.Dark Apr 04 '20 at 11:53

2 Answers2

1

Download Microsoft Build Tools if you haven't yet.

The error says that cl.exe is not found. If you have it installed , go to programs and features and repair the tools.
For more refer here.

Mr.Dark
  • 42
  • 1
  • 15
0

Source: python pip on Windows - command 'cl.exe' failed

You need to have cl.exe (the Microsoft C Compiler) installed on your computer and in your PATH. PATH is an environment variable that tells Windows where to find executable files.

First, ensure the C++ build tools for Visual Studio are installed. You can download Build Tools for Visual Studio separately from the Visual Studio downloads page, then choose C++ build tools from the installer. If you already have Visual Studio, you can also install Desktop development with C++ from the Visual Studio Installer which you should have in Start Menu.

Then, instead of the normal Command Prompt or PowerShell, use one of the special command prompts in the Visual Studio folder in Start Menu. For 32-bit Python, you're probably looking for x86 Native Tools Command Prompt. This sets up PATH automatically, so that cl.exe can be found.

Angus
  • 3,680
  • 1
  • 12
  • 27