I've been trying to install/build pyaudio with little success. When I try to build it from the source, I get this:

pi@pi:~/pyaudio $ sudo python setup.py install
running install
running bdist_egg
running egg_info
writing src/PyAudio.egg-info/PKG-INFO
writing top-level names to src/PyAudio.egg-info/top_level.txt
writing dependency_links to src/PyAudio.egg-info/dependency_links.txt
reading manifest file 'src/PyAudio.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'src/PyAudio.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv6l/egg
running install_lib
running build_py
running build_ext
building '_portaudio' extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-armv6l-2.7/src/_portaudiomodule.o
src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
 #include "portaudio.h"
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

Needless to say, I have installed portaudio (built from source). Trying to install pyaudio or portaudio or any dependency gives me 'unable to locate package'. What am I missing?

  • try this sudo apt install portaudio-dev then rerun the above command. You can also try this sudo apt-get install libportaudio2 Nov 10, 2017 at 17:57

2 Answers 2


Ref: https://engineeringlearning.blogspot.com/2017/08/installing-pyaudio-on-debian-on.html

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

Eventually I installed Stretch and things were straightforward from then on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.