2
C:\Users\gabri\OneDrive\Desktop>pip3 install pyaudio
Collecting pyaudio
  Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Installing collected packages: pyaudio
    Running setup.py install for pyaudio ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\gabri\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\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\gabri\AppData\Local\Temp\pip-record-032v86d_\install-record.txt' --single-version-externally-managed --compile --user --prefix=
         cwd: C:\Users\gabri\AppData\Local\Temp\pip-install-r9cgblze\pyaudio\
    Complete output (9 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    copying src\pyaudio.py -> build\lib.win-amd64-3.7
    running build_ext
    building '_portaudio' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\gabri\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\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\gabri\AppData\Local\Temp\pip-record-032v86d_\install-record.txt' --single-version-externally-managed --compile --user --prefix= Check the logs for full command output.

My python version: 3.7.4 and pip is upgraded.

I have already tried "python3.7 -m pip install PyAudio", but it still did not work.

I have tried installing it from a .whl too, but when I run the command, the following message appears:

ERROR: PyAudio-0.2.11-cp34-cp34m-win32.whl is not a supported wheel on this platform."

I tried with 32 and 64 bit.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
  • Have you tried resolving this part of the error _Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/_ – fdcpp Dec 24 '19 at 10:06
  • This may also be relevant https://stackoverflow.com/questions/29846087/microsoft-visual-c-14-0-is-required-unable-to-find-vcvarsall-bat#40888720 – fdcpp Dec 24 '19 at 10:08
  • Near the end of the error massage, we can see: ``` error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/ ``` So the error is self explanatory. Just goto the link, download and install Microsoft Visual C++ :) – Qazi Fahim Farhan Dec 24 '19 at 10:13

5 Answers5

9

Currently, there are wheels compatible with the official distributions of Python 2.7, 3.4, 3.5, and 3.6.

Apparently, there is no version of that library for Python 3.7, so I'd try downgrading the Python version.

Download the wheel on this site: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio.

Choose:

  • PyAudio‑0.2.11‑cp37‑cp37m‑win32.whl if you use 32 bit
  • PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl for 64 bit

Then go to your download folder:

cd <your_donwload_path>
pip install PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
animeshk
  • 376
  • 1
  • 7
  • I'll add a little more because this was completely foreign to me and this understanding helped. A "wheel" is an already-compiled version of pyaudio, or something close to that? Anyway, this error about Visual Studio is telling you to download VS to be able to compile your own version. That's like a 6 gig download today to compile a little 100K pyaudio file. You don't need that. Just get this already-compiled version and follow the directions to install it locally. – Mattamue Oct 11 '21 at 22:06
0

You need to install Microsoft Visual C++ 14.0

This should work https://visualstudio.microsoft.com/visual-cpp-build-tools/

0
pip install pipwin

pipwin install pyaudio

pipwin will automatically do the download of required wheel, as it installs unofficial Python package binaries for windows.

Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39
0

Whenever there is a build type error or say C++ 14.0 build tool required,just follow these simple steps-

  1. Goto and scroll down for Pyaudio - enter link description here

  2. Here you have to download wheel file according your python version and according to your python 32bit or 64 bit.

Note: download wheel file where your python is installed or keep there.

Example: my python version is 3.8 and python installed is 32bit so I downloaded this -- PyAudio‑0.2.11‑cp38‑cp38‑win32.whl

enter image description here

Gulshan Aggarwal
  • 954
  • 1
  • 7
  • 13
-1
pip install pipwin

pipwin install pyaudio

This worked straight away for me without installing any visual studio stuff, python --version is 3.9.5.

I've just done a fresh install of windows 10 a few days ago on my machine

  • Welcome to Stack Overflow! Please check that your solution was not already proposed in another answer ([this one](https://stackoverflow.com/a/63132079/6682517) actually) before posting it. – Sergey Shubin Jun 28 '21 at 14:28