Error importing matplotlib.pyplot on Streamlit Server

Hello,

I created a Streamlit natural language processing app hosted on Streamlit Cloud that has been working great for the last few months. Today, however, I tried to access the app and got the following error:

ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:
File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/scriptrunner/script_runner.py", line 557, in _run_script
    exec(code, module.__dict__)
File "/app/text_analysis_application/Conduit_Application.py", line 11, in <module>
    import matplotlib.pyplot as plt

Here is the link to the app: https://buckeyes2019-text-analysis-applicati-conduit-application-72tosn.streamlitapp.com/

I tried removing “import matplotlib.pyplot as plt” from the script and rebooting the app, but then I got the same error with the next import on the list (I think its numpy).

Also strange is that, when I run the app logged into Streamlit Cloud, I no longer see the black square in the bottom right corner that allowed me to access the logs.

So, in short, the app worked normally for months up until today. The last time I accessed it before today was probably a week ago.

Any help/ideas are appreciated. Thank you!

Hi @Buckeyes2019,

Thanks for posting!

Can you share your requirements.txt file or a link to the GitHub repository?

Caroline :balloon:

Yes here is the repo: GitHub - Buckeyes2019/Text_Analysis_Application: Streamlit web application demonstrating multiple natural language processing techniques.

Thank you!

Hi @Buckeyes2019 :wave:

Have you tried clearing cookies and signing out and back in with the same email / GitHub account with which you deployed the app?

pip was failing to resolve dependency conflicts. To fix the issue:

  1. Delete the app on Streamlit Cloud
  2. Replace the contents of requirements.txt with the following:
    keybert==0.6.0
    keyphrase_vectorizers==0.0.10
    matplotlib==3.5.2
    numpy==1.21.6
    pandas==1.3.2
    Pillow==9.2.0
    plotly==5.8.2
    railroad==0.5.0
    scikit_learn==1.1.2
    sentence_transformers==2.2.2
    spacy==3.2.0
    streamlit==1.11.1
    streamlit_option_menu==0.3.2
    textacy==0.12.0
    umap-learn==0.5.3
    wordcloud==1.8.2.2
    en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.2.0/en_core_web_sm-3.2.0.tar.gz
    cluestar @ git+https://github.com/Buckeyes2019/cluestar_2.git
    
  3. Re-deploy your app :balloon:
1 Like

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