Installing pyaudio with pip in a virtualenv


This worked for me, I had the same problem:

if you want to install PyAudio inside a virtualenv, install the PortAudio development headers from APT, then PyAudio:

sudo apt-get install portaudio19-dev
pip install --allow-unverified=pyaudio pyaudio

Some packages require the support of non-Python software, such as shared libraries. These cannot be installed via pip (they're not Python packages!). You generally install these on the host using your host's package manager (apt-get or yum or dnf, etc...), or you use something like Docker to encapsulate both the dependencies and your application.

In your case, pyaudio requires a number of libraries, including at least portaudio. You will need to install the appropriate development packages on your system, as suggested in the comments on your question.

Following steps worked for me :) Please go through and try

1  sudo apt-get install libasound-dev
2  sudo apt-get install portaudio19-dev
3  pip install pyaudio --user

OR (--user dont work then try python3-pyaudio)

sudo apt-get install python3-pyaudio