Question

[Solved] I can’t install pyaudio on Windows? How to solve “error: Microsoft Visual C++ 14.0 is required.”?

I have a Windows 10 PC and I want to install pyaudio to use it with my chatbot, powered by chatterbot.

I tried 2 different ways to install pyaudio.

The first way is doing this on the command prompt:

python -m pip install PyAudio

This is the result:

   C:UsersWaaberi>python -m pip 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
    Complete output from command C:UsersWaaberiAppDataLocalProgramsPythonPython37-32python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\Waaberi\AppData\Local\Temp\pip-install-e5le61j0\PyAudio\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersWaaberiAppDataLocalTemppip-record-adj3zivlinstall-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating buildlib.win32-3.7
    copying srcpyaudio.py -> buildlib.win32-3.7
    running build_ext
    building '_portaudio' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
Command "C:UsersWaaberiAppDataLocalProgramsPythonPython37-32python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\Waaberi\AppData\Local\Temp\pip-install-e5le61j0\PyAudio\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersWaaberiAppDataLocalTemppip-record-adj3zivlinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersWaaberiAppDataLocalTemppip-install-e5le61j0PyAudio

The second way is entering this command:

python pip install python-pyaudio

and it does nothing.

Solution #1:

The answer by Agalin is already great and I just want to explain it in a step by step format for a novice like myself:

  • find your Python version by python --version mine is 3.7.3 for example
  • the easiest way to check either you have 64 or 32 Python just open it in the terminal:

  • find the appropriate .whl file from here, for example mine is PyAudio?0.2.11?cp37?cp37m?win_amd64.whl, and download it.
  • go to the folder where it is downloaded for example cd C:UsersfoobarDownloads
  • install the .whl file with pip for example in my case:
pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
Respondent: Foad

Solution #2:

First run your IDE or CMD as Administrator and run the following:

pip install pipwin
pipwin install pyaudio
Respondent: Zafar Faheem

Solution #3:

There is no wheel (prebuilt package) for Python 3.7 on Windows (there is one for Python 2.7 and 3.4 up to 3.6) so you need to prepare build environment on your PC to use this package. Easier would be finding the wheel for 3.7 as some packages are quite hard to build on Windows.

Christoph Gohlke (University of California) hosts Windows wheels for most popular packages for nearly all modern Python versions, including latest PyAudio. You can find it here: https://www.lfd.uci.edu/~gohlke/pythonlibs/ (download can be quite slow). After download, just type pip install <downloaded file here>.

There is no difference between python -m pip install, and pip install as long as you’re using default installation settings and single python installation. python pip actually tries to run file pip in the current directory.

Edit. See the pipwin comment for automated way of using Mr Goblke’s libs . Note that I’ve not used it myself and I’m not sure about selecting different package flavors like vanilla and mkl versions of numpy.

Respondent: Agalin

Solution #4:

Use Conda instead of pip.
It works perfectly

conda install PyAudio
Respondent: Par bas

Solution #5:

you may need to try

pip install --upgrade setuptools

you may also need to install Visual Studio 2015, and remember to choose to install Visual C++ 14.0
https://visualstudio.microsoft.com/visual-cpp-build-tools/

Respondent: Jonas Wolff

Solution #6:

If you have anaconda install than you just need to use command: conda install PyAudio.

In order to execute this command you must set thePYTHONPATH environment variable in anaconda.

Respondent: Ritik Jain

Solution #7:

You should install python 3.6 version because python 3.7 version doesn’t support pyaudio
1 step : Then download the .whl file
according to your python version and the configuration of your machine in your python folder which is newly installed. For me it is python 3.6 and 64 bit machine. Download the file from here
(https://www.lfd.uci.edu/~gohlke/pythonlibs/)
2 step : run your cmd and type ” pip install your downloaded file name here

Solution #8:

The problem is pyaudio does not have wheels for python 3.7 just try some lower version like 3.6
then install pyaudio

It works

Respondent: johnson

Solution #9:

I have got the same error as :

error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: https://visualstudio.microsoft.com/downloads/

As, said by @Agaline, i download the outside wheel from this Christoph Gohlke.

If your is Python 3.7 then try to PyAudio?0.2.11?cp37?cp37m?win_amd64.whl and use command as, go to the download directroy and:

pip install PyAudio?0.2.11?cp37?cp37m?win_amd64.whl and it works.

Respondent: susan097

Solution #10:

If you are using Python 3.7.3 and Windows 10 64-bit machine then try the following command.
Go to the download folder and Install following command:

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

and it should work.

Respondent: shreyash

Solution #11:

You should just install python 3.6. I tried it and it worked. Just install that version of python and just do the normal download process (pip install pyaudio).

Respondent: arivvid27

Solution #12:

Seems PyAudio is supported by Python 2.7, 3.4, 3.5, and 3.6. Refer https://people.csail.mit.edu/hubert/pyaudio/

Please suggest if there is any alternate way to install PyAudio on Python 3.8.2

Respondent: Mayank Tripathi

Solution #13:

I had the same issue but solved it by using Ubuntu.

  1. python -m pip install pyaudio
  2. Install sudo, apt-get and then install homebrew &/ linuxbrew on your linux subsystem using Ubuntu.
  3. The latest version supports ubuntu.
  4. brew install portaudio
  5. Make sure you have python/python3 installed on the terminal
  6. Make sure the current location is added as path in your virtual computer’s path in environment Variable.
  7. brew link portaudio
Respondent: Rudraksh Jain

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy