Click here to Skip to main content
15,867,986 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
No module named ‘pyaudio’ in Ubuntu python app.
This is because pip3 install PyAudio fails because no such file as portaudio.h.

What I have tried:

It has been awhile since I tried accessing the microphone and speaker from Ubuntu. I was waiting for others to solve this problem.
Posted
Updated 3-Apr-23 10:56am
v3

I resolved this issue with the following:
sudo apt install portaudio19-dev

The WSL2 Ubuntu-22.04 did not have portaudio installed.

The portaudio.h file is provided by portaudio19-dev package. The file list
of that package can be found here
https://packages.ubuntu.com/jammy/amd64/portaudio19-dev/filelist. 
 
Share this answer
 
A simple Google search finds PyAudio · PyPI[^].
 
Share this answer
 
Comments
Edmond Seymore 29-Mar-23 8:24am    
Have you run pyaudio under Ubuntu 22.04 under WSL2 with Windows 11? It has been awhile; but, I do not remember that not installing PyAudio was the problem. I believe the problem is with sharing the devices between Window and Ubuntu.
Richard MacCutchan 29-Mar-23 8:45am    
Sorry, I have not tried it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900