[Solved] Fix PyAudio Pip Installation Errors on a Win 32/64-bit Operating System

Steve Matindi
4 min readSep 9, 2021

Here are the methods we’re going to use to make sure one of them fixes your issue within the shortest time:

  1. Using PyAudio Wheel File.
  2. Using Pipwin.
  3. Using Conda.
  4. Installing Buildtools from Microsoft.

Method 1: Manually installing pyaudio wheel file

To achieve the installation of PyAudio and solve the installation issues using this method, follow the below short steps:

Step 1. Open PowerShell and or command prompt and type the below command to check the current python version on your system :

python

Step 2. Next, go to the below link and download PyAudio wheel file (A 32-bit or 64-bit according to your system):

https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

Now, what you’ll want to do is choose PyAudio .whl file according to the python version and system you identified in the previous step.

In my case, I went with PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl since I was on a 64-bit machine utilizing python version 3.7. See the screenshot below to view the different variants available according to your python version.

Step 3. After identifying the version you need, click(press) it to save it via the provided pop up window.

Step 4: Open PowerShell and or command prompt (CMD) and install the wheel file you’ve downloaded from the previous step.

In my case, I downloaded it to the download folder hence the reason I changed the current directory to Downloads > path to the .whl file:

PS C:\Users\Lee> cd Downloads(Changes directory to Downloads folder)

After changing the directory, identify the file name and install it using pip as seen in the below command while still in the same path to the .whl file:

pip install PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl

Now verify its installation by trying to import it, as seen in the above sample screenshot.

If it throws some errors, verify you installed it from the path in which the wheel file is in, and try reinstalling it again. If that fails, move on to our second method.

Method 2: Using Pipwin to install PyAudio

Pipwin is a tool by Christoph Gohlke for pip, that helps you install unofficial python package binaries for windows directly from http://www.lfd.uci.edu/~gohlke/pythonlibs/. This will be handy to avoid doing it manually like the way we did it in step 1 above.

To achieve the installation, all you have to do is use these two steps on your command prompt (CMD) as an Administrator:

C:> pip install pipwinC:> pipwin install pyaudio

Then afterwards, verify the installation was successful by trying to import it. The only downside of this step that made use first step is that it requires the user to be on higher versions of Python. Something like Py v. ≥ 3.9.

Learn more about pipwin here: https://pypi.org/project/pipwin/

Method 3: Installing PyAudio using Conda

If you have conda installed in the system, use the below commands:

(a) Setting up Conda-Forge :

conda config --add channels conda-forge

(b) Next, use the below command to install pyaudio:

conda install pyaudio

For information about creating, selecting and activating an environment if you’re working from VS Code, use this link: How to select-and-activate-an-environment

Conda-forge is a community effort that provides conda packages for a wide range of software all for free

A podcast by Michael Kennedy talking more of Conda & Conda-Forge

Method 4: Installing Visual C++ Build Tools to Fix PyAudio Errors

The final method to solve this issue that we will use is by installing the official Microsoft Visual C++ build tools displayed in your log file.

To achieve this, follow the below steps:

Step 1: Navigate to the official Microsoft Build Tools link, and download the build tools. Here’s the link to use: https://visualstudio.microsoft.com/visual-cpp-build-tools/

Step 2: Follow the setup procedure and choose to install C++ Build Tools within the workloads window, and press install to start the installation process as seen in the sample screenshot below:

Step 3: Restart your machine (computer) and now try installing PyAudio via pip with the Command Prompt using the below command:

pip install pyaudio

The final step is to verify the installation via import on python shell /in the integrated development environment (IDLE).

Python 3.7.0a4 (v3.7.0a4:07c9d85, Jan 9 2018, 07:07:02) [MSC v.1900 64 bit (AMD64)] on win32
Type “copyright”, “credits” or “license()” for more information.
>>> import pyaudio
>>>

That’s all for now guys! I hope this helps you or your friend❤.

--

--

Steve Matindi

“Knowing is not enough; we must apply. Wishing is not enough; we must do.” — Von Goethe