Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

portaudio.h: No such file or directory #9896

Open
1 of 2 tasks
EdSeymore opened this issue Apr 3, 2023 · 11 comments
Open
1 of 2 tasks

portaudio.h: No such file or directory #9896

EdSeymore opened this issue Apr 3, 2023 · 11 comments

Comments

@EdSeymore
Copy link

Windows Version

Microsoft Windows [Version 10.0.22621.1413]

WSL Version

WSL version: 1.1.3.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

Linux version 5.15.90.1-microsoft-standard-WSL2

Distro Version

Release: 22.04

Other Software

miniconda conda 23.3.1
pip3 pip 23.0.1
PyAudio

Repro Steps

pip3 install PyAudio

  • fatal error: portaudio.h: No such file or directory

Expected Behavior

normal PyAudio install as under native Ubuntu 22.04

Actual Behavior

fatal error: portaudio.h: No such file or directory

Diagnostic Logs

No response

@Biswa96
Copy link

Biswa96 commented Apr 3, 2023

The issue is not related to WSL. Please report any on-topic issues.

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.

@EdSeymore
Copy link
Author

It is my understanding that portaudio is provied by standard Ubuntu package and that WSL supplies a non standerd Ubuntu for the WSL support. The files referenced are not present in my Ubuntu 22.04 image under WSL2 with Windows 11.

@Biswa96
Copy link

Biswa96 commented Apr 3, 2023

The portaudio19-dev has to be installed to get that portaudio.h file.

@elsaco
Copy link

elsaco commented Apr 3, 2023

@EdSeymore you need to add the portaudio19-dev package. This package contains the development files and not installed by default. apt install portaudio19-dev should take care of it.

@EdSeymore
Copy link
Author

Thanks. Now Successfully installed PyAudio-0.2.13.

@EdSeymore
Copy link
Author

Now I am getting a stream of messages from ALSA lib:

ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM sysdefault
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
and many more:

This may not be an WSL2 problem; but, I am trying really hard to use WSL2 with Ubuntu in place of a separate Ubuntu system and the complexity of the Operating Systems is making this really difficult.

End users should not have this much trouble setting up a working environment to run python applications. Trying to debug configuration problems with web search has not been productive for me.

I really have no idea how Windows and Ubuntu share devices on a single system and very little desire to know. I just would like for supportted systems to actually work when installed.

WSL2 just happens to be a key component.

Has anyone gotten PyAudio to work on Ubuntu 22.04 with Windows 11 and WSL2 without the ALSA lib messages?

Suggestions would be appreciated.

@EdSeymore EdSeymore reopened this Apr 11, 2023
@EdSeymore
Copy link
Author

@EdSeymore
Copy link
Author

The python3 code to illistrate this conditions is as follows:

#!/usr/bin/env python3

-- coding: utf-8 --

import pyaudio
import wave
import sys
CHUNK = 1024
file_path = "audio.wav"
wf = wave.open(file_path, 'rb') # Modified ets 01/31/2023
t_audio =wf.getnframes() / wf.getframerate()
p = pyaudio.PyAudio()
stream = p.open(format=p.get_format_from_width(wf.getsampwidth()),
channels=wf.getnchannels(),
rate=wf.getframerate(),
output=True)
while len(data := wf.readframes(CHUNK)):
stream.write(data)
stream.close()
p.terminate()
wf.close()

@gml16
Copy link

gml16 commented Aug 2, 2023

I am having the same issue. Has there been any update regarding this please?

@Jeronymous
Copy link

At the time being, has anyone succeeded to have pyaudio working in WSL2?

@pranav-manik
Copy link

^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants