Menu
PyAudio problem solved

PyAudio not installing: Now Solved!

In this article, I will be sharing with you how to solve one of the most annoying problems, python coders have to suffer from- "Error installing PyAudio"

PyAudio provides Python bindings for PortAudio, the cross-platform audio I/O library. With PyAudio, you can easily use Python to play and record audio on a variety of platforms.This module is a dependence of Speech Recognition module in python. This error is very irritating when you are building a voice assistant and the computer can't use speech recognition

The error actually happens because when we install PyAudio from PIP, it fails to install _portaudio bindings and several build tools for it which is severe dependence for PyAudio to work.

pyaudio error

Fatal Error: Cannot open include file 'portaudio.h' :'No such file in directory'

How to solve it?

Follow the given steps:-

  1. First uninstall the error version of PyAudio by running the following command in powershell:-
  2. pip uninstall pyaudio
  3. Go to unofficial python binaries
  4. Press CTRL+F and type pyaudio
  5. Click on PyAudio and then download the appropriate .whl file according to the installed version of python in your system.
  6. Go to the download folder on your pc and find where it was downloaded.
  7. Open Powershell on the same window.
  8. Type "pip install pya" and press tab, it will autocomplete
  9. Press Enter
  10. Bingo pyaudio has been successfully installed
  11. To test this open python and run any program involving pyaudio and you won't get any error.
  12. Best of luck for your voice assistant!
  13. Happy Coding!