Cannot install pyaudio, gcc error

Mittenchops picture Mittenchops · Nov 16, 2013 · Viewed 46.3k times · Source

Trying to install pyaudio with instructions per here:

$ git clone http://people.csail.mit.edu/hubert/git/pyaudio.git
$ cd pyaudio
$ sudo python setup.py install
running install
running build
running build_py
running build_ext
building '_portaudio' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-2.7/src/_portaudiomodule.o
In file included from /usr/include/python2.7/Python.h:8:0,
                 from src/_portaudiomodule.c:28:
/usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

What's going wrong in my installation?

Answer

AI_ROBOT picture AI_ROBOT · Feb 24, 2016

Sorry about the inappropriate answer last time, I will post the solution of the question. It might be helpful for Ubuntu distributions.

  1. First we need to install portaudio modules: sudo apt-get install libasound-dev

  2. Download the portaudio archive from: http://files.portaudio.com/download.html

  3. Unzip the archive: tar -zxvf [portaudio.tgz]

  4. Enter the directory, then run: ./configure && make

  5. Install: sudo make install

  6. And finally: sudo pip install pyaudio

  7. Check the version of pyaudio, it should be 0.2.9