OSError: sndfile library not found

Hi, my app suddenly stopped working and I’m getting the following errors:

On the main page: OSError: sndfile library not found
And my logs are:

Err:1 http://deb.debian.org/debian buster/main amd64 python3.7-minimal amd64 3.7.3-2+deb10u2
  404  Not Found [IP: 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/python3.7/python3.7-minimal_3.7.3-2+deb10u2_amd64.deb  404  Not Found [IP: 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

I tried to use --fix-missing but it didn’t work for me

Give us a bit more context please.
Are we talking about Streamlit sharing?
If yes, please provide a link to your public github repo.
I am guessing you are using the librosa library?

Hi @Maria :grinning_face_with_smiling_eyes:

I see the error on the main page of the Speech Emotion Recognition app you’ve previously shared :mag:

Could you first try replacing libsndfile-dev in line 5 of packages.txt with libsndfile1 ? If that doesn’t work, try replacing it with libsndfile1-dev and let us know if it helps :crossed_fingers:

Happy Streamlit-ing! :balloon:

1 Like


This will do the job in your packages.txt file:

1 Like

Hi @snehankekre! Thanks for the answer, but it doesn’t work for me either. I replaced libsndfile-dev with libsndfile1-dev and then with libsndfile1 and even tried to install both of them, but the error remained.

Thanks for getting back to me, @Maria :balloon:

I was able to fork your repo and successfully deploy to Streamlit Sharing after adding libsndfile1-dev to packages.txt. The contents of the file are exactly the following:


Could try making the :point_up: change and re-booting your app?

The app should look like this once you reboot it:

Happy Streamlit-ing! :balloon:

It was really helpful. I just deleted the app and reinstalled it from the repo and everything works! Many thanks.
Have a nice day! :slightly_smiling_face:

1 Like

Yay!! :tada: Happy to help :partying_face:

1 Like

I doubt that most of these packages are even needed. :wink:


I also noticed that your requirements.txt is bloated with lots of packages that I don’t think are needed. This can also lead to unwanted problems during deployment.

1 Like


I cloned your repository and cleaned it up a bit.
I tested it locally in a docker container and also on streamlit sharing.
Find the repo here:

The only required packages in packages.txt seems to be:


Hi @Franky1!
Wow, thank you very much for your help :relaxed: :pray:
I definitely need to learn more about deployment. Could you recommend some tools for me to determine which libraries I need for a project and which ones are unnecessary?

Regarding the python pip libraries, this is relatively simple.
All imports that do not belong to the Python standard library and that you use in your python program with import must be entered in the requirements.txt file.

There is also a python tool called pipreqs that scans the python scripts for non-standard import modules and writes them to a requirements.txt file.

But be careful: Sometimes the import modules are named differently than the package name you want to install.
For example: import cv2 versus pip install opencv-python-headless

There is no quick answer for the dependencies to be entered in packages.txt. To my knowledge, there is no tool for that either. Most python pip packages do not need additional apt install packages.
If they do, only helps: I look in the documentation of the python libraries, usually there is described which external libraries are required as prerequisites.

For corresponding error messages you can also google, but not everything you find e.g. on stackoverflow is correct and up to date. A lot of information is outdated.

Also, I usually test my streamlit app locally first in a Docker container, which is very similar to the streamlit sharing runtime. If there are no error messages anymore and the streamlit app works, the deployment to streamlit sharing usually works as well.
You can also find the corresponding Docker files in my cloned github repo.