Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Last active March 28, 2024 21:33
Show Gist options
  • Star 31 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save diegopacheco/d5d4507988eff995da297344751b095e to your computer and use it in GitHub Desktop.
Save diegopacheco/d5d4507988eff995da297344751b095e to your computer and use it in GitHub Desktop.
How to Install pyaudio ubuntu 16.04 LTS?
sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
sudo apt-get install ffmpeg libav-tools
sudo pip install pyaudio
@maelfosso
Copy link

Thank you !

Copy link

ghost commented Apr 15, 2019

Worked for me on Ubuntu 17.10 :-)

@pks9862728888
Copy link

pip install PyAudio
pip3 install PyAudio
python -m pip install PyAudio
python -m pip3 install PyAudio

@sofianeMdjk
Copy link

Works great, thanks a lot Diego

@SantiagoLopezDeharo
Copy link

Thanks for this, I couldnt install it in the traditional but this worked just fine, and i have the 19.04 version.

@NarasimmanSaravana1994
Copy link

Please build and install the PortAudio Python bindings first.

I'm facing this issue

python version is 3.6
image

@rijusougata13
Copy link

i have python 3.6.9 64 bit and ubuntu 16. i cant install pyaudio .can you help me?

@JesusOfCarrots
Copy link

does it works under windows 10 too ?

@basit26374
Copy link

thanks it works

@rohanishervin
Copy link

Saved my time. thanks!

@jabha400bc
Copy link

Thanks a lot. Worked for me.

@techsci81
Copy link

i have python 3.6.9 64 bit and ubuntu 16. i cant install pyaudio .can you help me?

sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
sudo apt-get install ffmpeg libav-tools
pip install pyaudio

these commands worked.

but still I am facing issues. after I run the file:

n [1]: runfile('/home/sv/Desktop/ai/sr.py', wdir='/home/sv/Desktop/ai')
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map

@harishcoder-dev
Copy link

you are my hero!

@louisroby
Copy link

louisroby commented Apr 20, 2020

I succeeded using:

sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
sudo apt-get install ffmpeg
sudo apt-get install python-pyaudio
sudo apt-get install python3-pyaudio

@findtharun
Copy link

findtharun commented May 23, 2020

While Implementing This ( btw I am using Ubuntu)

import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source: # use the default microphone as the audio source
   audio = r.listen(source) # listen for the first phrase and extract it into audio data
   print("You said " + r.recognize(audio)) # recognize speech using Google Speech Recognition
 
   print("Could not understand audio")

I am getting error as
Please build and install the PortAudio Python bindings first.
An exception has occurred, use %tb to see the full traceback.

@IYERADavid
Copy link

thanks diego it work quickly

@Otumian-empire
Copy link

Otumian-empire commented Dec 25, 2020

sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
sudo apt-get install ffmpeg
sudo pip install pyaudio

The above worked without libav-tools for the installation of the dependencies.
This is the error message

~$ sudo apt-get install ffmpeg libav-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libav-tools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  ffmpeg:i386 ffmpeg

E: Package 'libav-tools' has no installation candidate

Now I get this error when I run the python file with the code below:

ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card

python code

import speech_recognition as sr

try:
    listener = sr.Recognizer()
    with sr.Microphone() as micro_phone:
        aud_msg = listener.listen(micro_phone)
        txt_msg = listener.recognize_google(aud_msg)
        print(txt_msg)
except:
    print("There is an error")

The message in the exception is not displayed unit I hit ctrl+c

@2shweet
Copy link

2shweet commented Jan 11, 2021

does it works under windows 10 too ?

To install on windows you need pipwin so it's

Pip or pip3 install pipwin
Then
Pipwin install pyaudio

@CodeWithAlvin
Copy link

thanks diego

@Gianlucca-git
Copy link

Mil Gracias!

@SukruGokk
Copy link

`Collecting PyAudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Building wheels for collected packages: PyAudio
Building wheel for PyAudio (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: '/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/bin/python3' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"'; file='"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-11kifqpj
cwd: /tmp/pip-install-ffwcbpr2/PyAudio/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: invalid command 'bdist_wheel'

ERROR: Failed building wheel for PyAudio
Running setup.py clean for PyAudio
Failed to build PyAudio
Installing collected packages: PyAudio
Running setup.py install for PyAudio ... error
ERROR: Command errored out with exit status 1:
command: '/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/bin/python3' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"'; file='"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-096oscdf/install-record.txt --single-version-externally-managed --compile --install-headers '/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/include/site/python3.8/PyAudio'
cwd: /tmp/pip-install-ffwcbpr2/PyAudio/
Complete output (16 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
copying src/pyaudio.py -> build/lib.linux-x86_64-3.8
running build_ext
building '_portaudio' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/include -I/usr/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.8/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: portaudio.h: Böyle bir dosya ya da dizin yok
29 | #include "portaudio.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: '/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/bin/python3' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"'; file='"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-096oscdf/install-record.txt --single-version-externally-managed --compile --install-headers '/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/include/site/python3.8/PyAudio' Check the logs for full command output`

@ZhymabekRoman
Copy link

`Collecting PyAudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Building wheels for collected packages: PyAudio
Building wheel for PyAudio (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: '/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/bin/python3' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"'; file='"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-11kifqpj
cwd: /tmp/pip-install-ffwcbpr2/PyAudio/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: invalid command 'bdist_wheel'

ERROR: Failed building wheel for PyAudio
Running setup.py clean for PyAudio
Failed to build PyAudio
Installing collected packages: PyAudio
Running setup.py install for PyAudio ... error
ERROR: Command errored out with exit status 1:
command: '/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/bin/python3' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"'; file='"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-096oscdf/install-record.txt --single-version-externally-managed --compile --install-headers '/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/include/site/python3.8/PyAudio'
cwd: /tmp/pip-install-ffwcbpr2/PyAudio/
Complete output (16 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
copying src/pyaudio.py -> build/lib.linux-x86_64-3.8
running build_ext
building '_portaudio' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/include -I/usr/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.8/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: portaudio.h: Böyle bir dosya ya da dizin yok
29 | #include "portaudio.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ERROR: Command errored out with exit status 1: '/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/bin/python3' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"'; file='"'"'/tmp/pip-install-ffwcbpr2/PyAudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-096oscdf/install-record.txt --single-version-externally-managed --compile --install-headers '/home/sukru/Masaüstü/YAZILIM/PYTHON/voiceAssistant/include/site/python3.8/PyAudio' Check the logs for full command output`

sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
sudo apt-get install ffmpeg
sudo apt-get install python-pyaudio
sudo apt-get install python3-pyaudio

And done.

@Poornima-J
Copy link

sudo apt-get install ffmpeg libav-tools

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libav-tools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
ffmpeg:i386 ffmpeg

E: Package 'libav-tools' has no installation candidate

This was the message i got but as mentioned above there was another package i386 ffmpeg to replace it. Hence at the end pyaudio downloaded successfully.
Thanks alot.

@NarasimmanSaravana1994
Copy link

sudo apt-get install ffmpeg libav-tools

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libav-tools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
ffmpeg:i386 ffmpeg

E: Package 'libav-tools' has no installation candidate

This was the message i got but as mentioned above there was another package i386 ffmpeg to replace it. Hence at the end pyaudio downloaded successfully.
Thanks alot.

@poonima-J

sudo apt-get update
sudo apt-get install -y libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg wget git vim

try this one

@Eeman1113
Copy link

i am getting these errors

eeman@eeman-Inspiron-3576:~$ sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libasound2-dev' instead of 'libasound-dev'
libportaudio2 is already the newest version (19.6.0-1build1).
libportaudio2 set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libasound2-dev : Depends: libasound2 (= 1.2.2-2.1ubuntu2.4)
E: Unable to correct problems, you have held broken packages.
eeman@eeman-Inspiron-3576:~$ sudo apt-get install ffmpeg libav-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libav-tools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  ffmpeg ffmpeg:i386

E: Package 'libav-tools' has no installation candidate
eeman@eeman-Inspiron-3576:~$ sudo pip install pyaudio
Collecting pyaudio
  Downloading PyAudio-0.2.11.tar.gz (37 kB)
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mn5wi77g/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mn5wi77g/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-3xpdi9l1
       cwd: /tmp/pip-install-mn5wi77g/pyaudio/
  Complete output (16 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  copying src/pyaudio.py -> build/lib.linux-x86_64-3.8
  running build_ext
  building '_portaudio' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/src
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.8/src/_portaudiomodule.o
  src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
     29 | #include "portaudio.h"
        |          ^~~~~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pyaudio
  Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
    Running setup.py install for pyaudio ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mn5wi77g/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mn5wi77g/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ofa27enw/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/pyaudio
         cwd: /tmp/pip-install-mn5wi77g/pyaudio/
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    copying src/pyaudio.py -> build/lib.linux-x86_64-3.8
    running build_ext
    building '_portaudio' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/src
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.8/src/_portaudiomodule.o
    src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
       29 | #include "portaudio.h"
          |          ^~~~~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mn5wi77g/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mn5wi77g/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ofa27enw/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/pyaudio Check the logs for full command output.

@master142
Copy link

I am getting some errors

ERROR: Complete output from command /usr/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-uriccz5b/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-0zx7264w/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
copying src/pyaudio.py -> build/lib.linux-x86_64-3.7
running build_ext
building '_portaudio' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.7m -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.7/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
29 | #include "portaudio.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-uriccz5b/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-0zx7264w/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-uriccz5b/pyaudio/

NOTE1: I am using fedora
NOTE2: Instead of apt-get I am using dnf

@viewDOTport
Copy link

i love u

@vineet-codes256
Copy link

vineet-codes256 commented Jan 5, 2022

How to install pyaudio in VS-code?

@vladimiregorov74
Copy link

Этот способ подходит для python 3.10
Для python 3.11 выдает ошибку

@nivaangupta
Copy link

I tried everything this whole thread has suggested
still getting the exact samew error:

error: subprocess-exited-with-error

× Building wheel for pyaudio (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-312
creating build/lib.linux-x86_64-cpython-312/pyaudio
copying src/pyaudio/init.py -> build/lib.linux-x86_64-cpython-312/pyaudio
running build_ext
building 'pyaudio._portaudio' extension
creating build/temp.linux-x86_64-cpython-312
creating build/temp.linux-x86_64-cpython-312/src
creating build/temp.linux-x86_64-cpython-312/src/pyaudio
gcc-11 -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/usr/local/include -I/usr/include -I/home/nng8603/jarvis-AI/napyork2/include -I/home/linuxbrew/.linuxbrew/opt/python@3.12/include/python3.12 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-312/src/pyaudio/device_api.o
error: command 'gcc-11' failed: No such file or directory
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment