ModuleNotFoundError plotly.express or plotly.graph_objects

I just started getting the following error. This app has been working or a few months now. Is plotly still available?

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.8/site-packages/streamlit/script_runner.py", line 379, in _run_script
    exec(code, module.__dict__)File "/app/streamlit-dcps-covid/web.py", line 2, in <module>
    import plotly.express as px, plotly.graph_objects as go

The code for this app is here - https://github.com/acedanger/streamlit-dcps-covid/blob/main/web.py

Hi @acedanger, welcome back!

I forked the repo and it launched from my account, so I’m not sure what to suggest other than to reboot the app. We’re not limiting what packages are available on Streamlit Cloud; if it can be installed from PyPI or conda, then it should work.

One thing I will recommend for this specific app is you’ve pinned Streamlit to 0.89, but versions of Streamlit > 1.1 have some memory enhancements that will make the app work even better on Streamlit Cloud. So you might consider that upgrade, if your code supports it.

Best,
Randy

Thanks @randyzwitch. I updated my dependencies and that appears to have resolved my problem.

1 Like

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 (most recent call last):
  File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py", line 379, in _run_script
    exec(code, module.__dict__)
  File "/app/sat-vs-gpa/app.py", line 2, in <module>
    import SAT_vs_GPA as model
  File "/app/sat-vs-gpa/SAT_vs_GPA.py", line 3, in <module>
    from matplotlib import pyplot as plt

Link: https://share.streamlit.io/grace-hephzibah/sat-vs-gpa/main/app.py
Repo: GitHub - Grace-Hephzibah/SAT-vs-GPA: A simple linear regression model using OLS method

When I locally host it, it works perfectly well. I don’t know the problem when I host it. Please help !!!

Hi @Grace_Hephzibah -

Your app appears to be working to me, plots are showing up and picking a number for the SAT returns a predicted GPA.

Best,
Randy

Thanks. I got irritated when I tried hosting multiple times but I am positive that it did not work yesterday. Anyway, it is working now. Thanks

I’m running into the same issues. I have plotly in my dashboard and it worked fine locally, but when I tried to deploy it’s getting the error “ModuleNotFoundError”

Below is error message when I try to run from the cloud but it is working fine in my system, Any help will he highly appreciated

ModuleNotFoundError: This app has encountered an error.

File “/app/streamlit_covid/covidPie_Line.py”, line 3, in
import plotly.express as px

My Code:

import streamlit as st
import pandas as pd
import plotly.express as px <— Error in Line 3 in cloud hosting

i try to do deploy but i have that same error:

2022-12-27 10:17:22.576 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "/app/dashboards-streamlit/Dashboard_Compras/app.py", line 1, in <module>
    import plotly.express as px
ModuleNotFoundError: No module named 'plotly'
2022-12-27 10:17:26.355 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "/app/dashboards-streamlit/Dashboard_Compras/app.py", line 1, in <module>
    import plotly.express as px
ModuleNotFoundError: No module named 'plotly'

You need to install plotly.

I only have plotly , I have other apps with plotly and it works normally, only this one happens in deploy

You need to install plotly in the deployment environment.

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