Import matplotlib.pyplot as plt results in ModuleNotFoundError

Hello community,
I’m a newbie to streamlit, so please be patient with me…
I’ve build a streamlit app that works fine on my machine, however if I try to deploy it, I get the error mentioned in the title. I’m working with conda environments, what should be fine as far as I can see from the documentation. It seems to be no problem to import streamlit, pandas and numpy, however matplotlib.pyplot gives an error. So far I’ve

  • updated my environment and got rid of unnecessary dependencies,
  • deleted the app and created a new one
    but the error still occurs. Do I have to rename the yml-file? Am I forced to switch to pip as a dependency manager? Or am I missing something completely different?
    Any help and assistance is highly appreciated!
    Cheers, Solarschmied

Please share the link to your public github repo, otherwise we can only guess unfortunately…

Sorry, I thought this happens automatically…

In the meantime I added a requirements.txt (If I understand the documentation correctly, this will be preferred before yml-files) and deleted the pinned python version (since this gave me a new error)
Now I’m waiting for almost have an hour, being told that my app is in the oven. Does this imply there are new errors to be expected? :see_no_evil:

Try it with this content below.

requirements.txt

numpy
pandas
Pillow
matplotlib
streamlit
2 Likes

Thankyou so much! :pray:
updating requirements.txt again, waiting for about an hour and then rebooting the app did it.
Just for my understanding, did not-adding “Pillow” cause the problem or is it in general a bad idea to lock versions if you want to deploy an app to the streamlit cloud?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.