I got the following error while trying to install pyaudio using pip3 in ubuntu 16.04:
JavaScript
x
23
23
1
Collecting pyaudio
2
Downloading PyAudio-0.2.11.tar.gz
3
Installing collected packages: pyaudio
4
Running setup.py install for pyaudio error
5
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-mxgvewdb/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-v55chjee-record/install-record.txt --single-version-externally-managed --compile:
6
running install
7
running build
8
running build_py
9
creating build
10
creating build/lib.linux-x86_64-3.5
11
copying src/pyaudio.py -> build/lib.linux-x86_64-3.5
12
running build_ext
13
building '_portaudio' extension
14
creating build/temp.linux-x86_64-3.5
15
creating build/temp.linux-x86_64-3.5/src
16
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.5/src/_portaudiomodule.o
17
src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
18
compilation terminated.
19
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
20
21
----------------------------------------
22
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-mxgvewdb/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-v55chjee-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-mxgvewdb/pyaudio/
23
Advertisement
Answer
This should help
JavaScript
1
2
1
$ sudo apt-get install portaudio19-dev python-pyaudio python3-pyaudio
2
Tested on Ubuntu 18.04
, Python 3.7.2
, pyaudio 0.2.11
Added 8th of Jan 2021:
On Ubuntu 20.04 you have to use:
JavaScript
1
2
1
$ sudo apt install portaudio19-dev python3-pyaudio
2