I'm kindly asking for your help. I'm trying to install pyaudio
in a python virtual environment version 3.9.1 on Ubuntu 20.04 but I get this error when I run pip install pyaudio
in my venv:
error: subprocess-exited-with-error
× Building wheel for pyaudio (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [18 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-39
creating build/lib.linux-x86_64-cpython-39/pyaudio
copying src/pyaudio/init.py -> build/lib.linux-x86_64-cpython-39/pyaudio
running build_ext
building 'pyaudio._portaudio' extension
creating build/temp.linux-x86_64-cpython-39
creating build/temp.linux-x86_64-cpython-39/src
creating build/temp.linux-x86_64-cpython-39/src/pyaudio
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include -I/usr/include -I/home/fany/Documents/a_soro/rep_travail/venv/include -I/home/fany/.pyenv/versions/3.9.1/include/python3.9 -c src/pyaudio/device_api.c -o
build/temp.linux-x86_64-cpython-39/src/pyaudio/device_api.o
src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
9 | #include "portaudio.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pyaudio ERROR:
Could not build wheels for pyaudio, which is required to install
pyproject.toml-based projects
I found that I need portaudio19-dev
so I try to install it with apt first but it didn't give info about the dependencies conflicts so I tried sudo aptitude install portaudio19-dev
and it give me this:
The following NEW packages will be installed: libasound2-dev{ab}
libjack-dev{a} libjack0{ab} libportaudiocpp0{a} portaudio19-dev 0
packages upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 526 kB of archives. After unpacking 4,108 kB will be used.
The following packages have unmet dependencies: libjack-jackd2-0 :
Conflicts: libjack-0.116 which is a virtual package, provided by:
- libjack0 (1:0.125.0-3build2), but 1:0.125.0-3build2 is to be installed
- libjack-jackd2-0 (1.9.12~dfsg-2ubuntu2), but 1.9.12~dfsg-2ubuntu2 is installed
Conflicts: libjack-0.125 which is a virtual package, provided by:
- libjack0 (1:0.125.0-3build2), but 1:0.125.0-3build2 is to be installed
- libjack-jackd2-0 (1.9.12~dfsg-2ubuntu2), but 1.9.12~dfsg-2ubuntu2 is installed
Conflicts: libjack0 but 1:0.125.0-3build2 is to be installed libasound2-dev : Depends: libasound2 (= 1.2.2-2.1) but
1.2.2-2.1ubuntu2.2 is installed libjack0 : Conflicts: libjack-0.116 which is a virtual package, provided by:
- libjack0 (1:0.125.0-3build2), but 1:0.125.0-3build2 is to be installed
- libjack-jackd2-0 (1.9.12~dfsg-2ubuntu2), but 1.9.12~dfsg-2ubuntu2 is installed
Conflicts: libjack-0.125 which is a virtual package, provided by:
- libjack0 (1:0.125.0-3build2), but 1:0.125.0-3build2 is to be installed
- libjack-jackd2-0 (1.9.12~dfsg-2ubuntu2), but 1.9.12~dfsg-2ubuntu2 is installed The following actions will resolve these dependencies:
Remove the following packages: 1) libjack-jackd2-0 [1.9.12~dfsg-2ubuntu2 (focal, now)]
Keep the following packages at their current version: 2) libasound2-dev [Not Installed] 3)
portaudio19-dev [Not Installed]
I don't know what to do from that point because in the past I remove or downgrade some packages and it results in a big problem in my OS.So this time I think it is safe to ask you first in case you had a similar issue with pyaudio the options that you choose in the suggestions of aptitude. How can I deal with this issue and be able to install pyaudio in my virtual environment.