OSError: libespeak.so.1: cannot open shared object file: No such file or directory

Hi i get this error why generating text to speech, i have already installed

Select Activity > Plots (“as of now speech add only with the Plot module”)

if i use the other way around … by saying generating a mp3 file and playing it with playsound* give me ‘gi’ no module not found.

from gtts import gTTS
import os

# The text that you want to convert to audio 
mytext = 'Welcome Bob ,, how are you, '

# Language in which you want to convert 
language = 'en'

myobj = gTTS(text=mytext, lang=language, slow=False) 

from playsound import playsound

ModuleNotFoundError: No module named ‘gi’


File "/home/appuser/.local/lib/python3.7/site-packages/streamlit/script_runner.py", line 332, in _run_script
    exec(code, module.__dict__)File "/app/streamlit_churn_analysis/streamlit_churn.py", line 138, in <module>
    main()File "/app/streamlit_churn_analysis/streamlit_churn.py", line 128, in main
    run_churn_plots()File "/app/streamlit_churn_analysis/plot_learning.py", line 62, in run_churn_plots
    playsound("welcome.mp3")File "/home/appuser/.local/lib/python3.7/site-packages/playsound.py", line 91, in _playsoundNix
    import gi

Hi @rupak-roy -

I tried deploying your app from my account and don’t see any errors. So it’s hard to say what the fix might be without more information.

One side comment, it appears that your requirements.txt file has way more Python libraries that are actually required to run your app. If you can trim that down to just the libraries you need, you’ll have much better launch times for your app.


hi the app is working now becoz i need to show someone else hav to put back to default , yes i can understand there are lots of packages. my default env packages, i will trim, and also wil share you the github link separately with the code i am having problem with… the problem is the app uses text to speech functions like playsound etc to narrate or play an audio , it cant in share.streamlit gives the OSError likbespeak,… however itworks super fine locally in my laptop,it this the server hardware resource call restriction but it should play mp3 file via generating mp3 file and using playsound to play it, but cant…