The first problem is that libportaudio
is not available in the 64-bit RpiOS.
The deeper problem is that the advice you have been following is perhaps not very good -- I won't say definitely, because I'm not a user of pyaudio, but it smells like it a bit. My major reason for suspecting this is that there is a python-pyaudio
package available in 64 (and 32) -bit, and has been at least since buster and most likely for a long time before that.
Yet the article you link does not mention this even once, which implies the author was not aware and did not have a good understanding of linux package management systems. The python module is pyaudio
, so if it is available in the distro, very likely that is in the package name, and in fact there is a simple logic that can be observed in python package names such that we might assume this package is most likely called python-pyaudio
. But let's just search for pyaudio first:
> apt search pyaudio
Sorting... Done
Full Text Search... Done
python-pyaudio/oldstable 0.2.11-1+b2 arm64
Python bindings for PortAudio v19
python-pyaudio-doc/oldstable,oldstable 0.2.11-1 all
Documentation for Python bindings for PortAudio v19
python3-pyaudio/oldstable 0.2.11-1+b2 arm64
Python3 bindings for PortAudio v19
There are a couple more packages in the list returned that I have left off.
It is interesting that these are in oldstable
and not the stable
; this is a buster system so it means that package has been there since stretch, which is going back 4-5 years.1 The version listed here is explicitly for "PortAudio v19", which if we dig into their website a bit reveals that this is the current version.
It is important to understand that if the package manager installs something in its default mode, that software is ready to use. A major purpose of a package management system is that it manages dependencies for you.
There is both a python and python3 package available. Here's more about the latter:
> apt show python3-pyaudio
Package: python3-pyaudio
Version: 0.2.11-1+b2
Priority: optional
Section: python
Source: python-pyaudio (0.2.11-1)
Maintainer: Hubert Pham <[email protected]>
Installed-Size: 148 kB
Provides: python3.6-pyaudio, python3.7-pyaudio
Depends: python3 (<< 3.8), python3 (>= 3.6~), python3:any (>= 3.3.2-2~), libc6 (>= 2.17), libportaudio2 (>= 19+svn20101113)
Suggests: python-pyaudio-doc (>= 0.2.11)
Homepage: https://people.csail.mit.edu/hubert/pyaudio/
Download-Size: 25.3 kB
APT-Sources: http://deb.debian.org/debian buster/main arm64 Packages
Description: Python3 bindings for PortAudio v19
There are dependencies there including libportaudio2
, which presumably replaced libportaudio0
. Again: You do not have to go through the list of dependencies and install them all one at a time manually. By installing python[3]-pyaudio
, those dependencies will be included.
So, what you should have tried first was just:
sudo apt install python3-pyaudio
Presuming you want the python3 version. I can't promise this does work, but it is not hard to try.
- Meaning it was there when that article was written. This is actually good, since it implies that all the rigmarole there was not because the pyaudio package was broken but because the author was not aware it existed.
libportaudio0
in the 64-bit version whereas there is in the "oldstable" buster (v10) 32-bit. "oldstable" means imported from the previous release, stretch (v9).python-pyaudio
package in buster oldstable as well -- but including 64-bit. Have you tried that? It should pull in dependencies for you, unless the package is broken.apt show python-pyaudio
on buster 64-bit giveslibportaudio2
<- 2 not 0, which should be available.libportaudio2
. The problem is that it is not working. The pyaudio recognises I2S microphone, but never finisheswhile _stream.get_read_available() < sampnumb
.