Portaudio error

Hi, I have a voice assistant in my project, It works fine in my local system while deploying it throws an error, I am new to this, If any help is appreciated.

Pyaudio error
fatal error: portaudio

screenshot of my error

Hello @Jaiharish-passion07

I think we had this issue before here: PortAudio Library Not Found

Depending on where you are deploying there should be an intermediate step to instapp apt packages, this is where you’d want to install PortAudio. Hope that clears some things up!

EDIT: ah wait this is on Streamlit Share, let me check real quick.

EDIT2: so I “think” I got this working using this. Did not fully test but it doesn’t err anymore at the install.

Add a packages.txt file at the root of your project with the following contents:

build-essential
libasound-dev
portaudio19-dev
python3-pyaudio

You can check this repo for a working example.

Have a nice day,
Fanilo

Thankyou @andfanilo it installed portaudio,but other pbm is I using microphone for my app,it does not configure,it shows this error


Is there possible can I use my microphone with streamlit app?
If Iam wrong let me know it,waiting for your reply…

Hey @Jaiharish-passion07,

In Streamlit, any Python code is going to be run server-side, which means when you are using device_index = pa.get_default_input_device(), it is going to try and get the audio device from the service in the Cloud instead of the device from your browser.

You need to implement code to read audio from the client-side and send it to the Python part for your purpose, which translates in writing JS code…One would normally build a dedicated Streamlit Component for this, integrating for example React-Mic. You may also be able to workaround this using the streamlit-bokeh-events package to pass JS code and interact with the MediaRecorder API as in this example:


All things aside, a Streamlit Audio recorder is a popular demand so if you or anyone can come to a first solution it would be awesomlit’

Fanilo

Hi @andfanilo, :blush:I really thanks for your help and it works fine well in Google Chrome not other browsers.
Is there a way to use python speech recognition library for listening voice input,while running in streamlit server using python alone.(sr.withMicrophone() as source:
source.listen())
If there is a way let me know it.
And once again thank you for your help :clap: