Pyaudio Picar-x installation error

pyaudio cant be installed. install pyaudio error:
Error:Looking in indexes: Simple index, piwheels - Simple index
Collecting pyaudio
Using cached PyAudio-0.2.14.tar.gz (47 kB)
Installing build dependencies: started
Installing build dependencies: finished with status ‘done’
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status ‘done’
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status ‘done’
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (pyproject.toml): started
Building wheel for pyaudio (pyproject.toml): finished with status ‘error’
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-aarch64-cpython-39
creating build/lib.linux-aarch64-cpython-39/pyaudio
copying src/pyaudio/ → build/lib.linux-aarch64-cpython-39/pyaudio
running build_ext
building ‘pyaudio._portaudio’ extension
creating build/temp.linux-aarch64-cpython-39
creating build/temp.linux-aarch64-cpython-39/src
creating build/temp.linux-aarch64-cpython-39/src/pyaudio
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-PN012d/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/local/include -I/usr/include -I/usr/include/python3.9 -c src/pyaudio/device_api.c -o build/temp.linux-aarch64-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/aarch64-linux-gnu-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
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects

Try to fix it yourself, or contact with this message

Please provide more detailed information so that we can help you better:

  1. what product are you using?
  2. what commands are you running that are causing the problem?
  3. what system are you using, Raspberry Pi OS, Bullseye or Bookworm, 32-bit or 64-bit.
  1. Picar-x robotics kit
  2. and (but now i restarted the whole robot and all of the codes are not working due to pyaudio not downloading)
  3. Raspberry Pi Legacy 64-bit

Try installing pyaudio manually.
sudo pip3 install pyaudio --break-system-packages

1 Like