Solution – PyAudio failed to install on Windows 10

PyAudio failed to install on Windows 10 is a Python WebDriver error which occurs when you are not correctly installing PyAudio.

In this article I am going to try and solve the error while I try to explain why the error is actually popping up, we will also introduce some solutions that worked for other developers and see if those solutions can solve the error in your particular situation.

Explaining the Error : PyAudio failed to install on Windows 10

The error can happen to anyone trying to install PyAudio and not doing it the correct way.

Obviously thee error will happen after the following command.

                                                                       #
pip install pyaudio
                                                                       #

The error should look very similar to the error bellow. Make sure you are getting a very similar error message.

                                                                       #
C:\Users\acj>pip install pyaudio
Collecting pyaudio
Installing collected packages: pyaudio
  Running setup.py install for pyaudio ... error
..... 
C:\Users\PANKAJ~1\AppData\Local\Temp
c:\users\pankajkaun\desktop\python\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
src/_portaudiomodule.c: note: see previous definition of 'MS_WIN64'
src/_portaudiomodule.c(29): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
                                                                       #

Bellow is a list of solutions that will most likely solve the issue.

Solution 1 : download the wheel

The first solution is to download and install the wheel from the link bellow.

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

Then,

                                                                       #
python -m pip install pyaudio
                                                                       #

I hope this solution is the one you were looking for. If not, try the solutions bellow.

Solution 2 : install pipwin.

The second solution is to use pipwin, you need to open the cmd aka the command line as an administrator.

pipwin is pip plus some precompiled binaries for windows.

First, start with using this command in order to install pipwin.

                                                                       #
pip install pipwin
                                                                       #

Then, you can use pipwin in order to install pyaudio.

                                                                       #
pipwin install pyaudio
                                                                       #

The commands above should solve the problem, as an alternative and last solution you can try the solution bellow.

Solution 3 : install portaudio first.

The third solution is for a few number of people. Sometimes, installing portaudio before will do the trick.

You can do that by using the command bellow.

                                                                       #
pip install portaudio
                                                                       #

Then you can proceed to installing pyaudio.

The solutions above should be enough to solve the problem, if you like our effort make sure to consider donating to our Kofi account, there is a red button that you can use if you are feeling generous.

Summing-up

Friends, I hope this article was helpful and help you in any way, shape or form, the first solution worked for me and also the third, depending on your case the solution could be different, just keep trying and do not give up, keep coding, cheers.

If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/