File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script exec(code, module.__dict__) File "/mount/src/dashboards/map.py", line 3, in <module> import plotly.express as px

File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)File "/mount/src/dashboards/map.py", line 3, in <module>
    import plotly.express as px
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).
1 Like

Hi @Ranu0005

The ModuleNotFoundError is hinting that a prerequisite library is not found. A simple fix is to add this library to the requirements.txt file, which in your case is most likely plotly.

Hope this helps.

1 Like

Hello dataprofessor,
Thank you for your response. i will try it.

1 Like

I have add all the necessary libraries in my requirements file but still i have faced same issue. could u please suggest me any other solutions. because same app run in locally very well but in streamlit share it’s not running . and throw module not found error.
please suggest some solutions.

1 Like

Search the logs for messages related to the installation of plotly.

2 Likes

Hi @Ranu0005

In addition to looking in the log as @Goyo had suggested, have you tried rebooting the app?

Also, check out the following FAQ we have on the topic:

FAQ: ModuleNotFoundError.

Happy Streamlit-ing! :balloon:

1 Like

Goyo, I have checked all the logs related to plotly installation . following logs are shown in my loga tab.

2024-02-21 08:54:26.811 Uncaught app exception
Traceback (most recent call last):
  File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)
  File "/mount/src/plotly_chart/plotly_chart.py", line 1, in <module>
    import plotly.express as px
ModuleNotFoundError: No module named 'plotly'
2024-02-21 08:54:26.911 503 GET /script-health-check (10.12.28.204) 102.00ms
2024-02-21 08:54:31.825 Uncaught app exception
Traceback (most recent call last):
  File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)
  File "/mount/src/plotly_chart/plotly_chart.py", line 1, in <module>
1 Like

Still got same error.

1 Like

That is the the application running. Installation of packages comes before that.

You might benefit from having somebody more experienced look at your repo.

1 Like
Collecting streamlit
  Downloading streamlit-1.31.1-py2.py3-none-any.whl (8.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.4/8.4 MB 114.6 MB/s eta 0:00:00[2024-02-21 12:40:36.223459] 
Collecting tzlocal<6,>=1.1
  Downloading tzlocal-5.2-py3-none-any.whl (17 kB)
Collecting altair<6,>=4.0
  Downloading altair-5.2.0-py3-none-any.whl (996 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 996.9/996.9 KB 214.2 MB/s eta 0:00:00[2024-02-21 12:40:36.364536] 
Collecting importlib-metadata<8,>=1.4
  Downloading importlib_metadata-7.0.1-py3-none-any.whl (23 kB)
Collecting tornado<7,>=6.0.3
  Downloading tornado-6.4-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (435 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 435.4/435.4 KB 254.0 MB/s eta 0:00:00[2024-02-21 12:40:36.565179] 
Collecting pandas<3,>=1.3.0
  Downloading pandas-2.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.0/13.0 MB 301.7 MB/s eta 0:00:00[2024-02-21 12:40:36.870402] 
Collecting watchdog>=2.1.5
  Downloading watchdog-4.0.0-py3-none-manylinux2014_x86_64.whl (82 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.0/83.0 KB 135.7 MB/s eta 0:00:00[2024-02-21 12:40:36.985737] 
Collecting pillow<11,>=7.1.0
  Downloading pillow-10.2.0-cp311-cp311-manylinux_2_28_x86_64.whl (4.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 295.8 MB/s eta 0:00:00[2024-02-21 12:40:37.360927] 
Collecting python-dateutil<3,>=2.7.3
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 KB 182.6 MB/s eta 0:00:00[2024-02-21 12:40:37.417730] 
Collecting protobuf<5,>=3.20
  Downloading protobuf-4.25.3-cp37-abi3-manylinux2014_x86_64.whl (294 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 294.6/294.6 KB 281.1 MB/s eta 0:00:00[2024-02-21 12:40:37.947850] 
Collecting pyarrow>=7.0
  Downloading pyarrow-15.0.0-cp311-cp311-manylinux_2_28_x86_64.whl (38.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 38.3/38.3 MB 303.5 MB/s eta 0:00:00[2024-02-21 12:40:38.244542] 
Collecting typing-extensions<5,>=4.3.0
  Downloading typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Collecting packaging<24,>=16.8
  Downloading packaging-23.2-py3-none-any.whl (53 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.0/53.0 KB 265.0 MB/s eta 0:00:00[2024-02-21 12:40:38.390299] 
Collecting toml<2,>=0.10.1
  Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting numpy<2,>=1.19.3
  Downloading numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.3/18.3 MB 192.2 MB/s eta 0:00:00[2024-02-21 12:40:38.874127] 
Collecting requests<3,>=2.27
  Downloading requests-2.31.0-py3-none-any.whl (62 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 KB 149.9 MB/s eta 0:00:00
Collecting tenacity<9,>=8.1.0
  Downloading tenacity-8.2.3-py3-none-any.whl (24 kB)
Collecting validators<1,>=0.2
  Downloading validators-0.22.0-py3-none-any.whl (26 kB)
Collecting pydeck<1,>=0.8.0b4
  Downloading pydeck-0.8.1b0-py2.py3-none-any.whl (4.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.8/4.8 MB 318.6 MB/s eta 0:00:00[2024-02-21 12:40:39.159095] 
Collecting blinker<2,>=1.0.0
  Downloading blinker-1.7.0-py3-none-any.whl (13 kB)
Collecting cachetools<6,>=4.0
  Downloading cachetools-5.3.2-py3-none-any.whl (9.3 kB)
Collecting click<9,>=7.0
  Downloading click-8.1.7-py3-none-any.whl (97 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.9/97.9 KB 168.3 MB/s eta 0:00:00[2024-02-21 12:40:39.324892] 
Collecting rich<14,>=10.14.0
  Downloading rich-13.7.0-py3-none-any.whl (240 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 240.6/240.6 KB 182.2 MB/s eta 0:00:00[2024-02-21 12:40:39.498216] 
Collecting gitpython!=3.1.19,<4,>=3.0.7
  Downloading GitPython-3.1.42-py3-none-any.whl (195 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 195.4/195.4 KB 350.1 MB/s eta 0:00:00[2024-02-21 12:40:39.563811] 
Collecting toolz
  Downloading toolz-0.12.1-py3-none-any.whl (56 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.1/56.1 KB 119.5 MB/s eta 0:00:00[2024-02-21 12:40:39.629941] 
Collecting jsonschema>=3.0
  Downloading jsonschema-4.21.1-py3-none-any.whl (85 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 85.5/85.5 KB 150.6 MB/s eta 0:00:00[2024-02-21 12:40:39.739840] 
Collecting jinja2
  Downloading Jinja2-3.1.3-py3-none-any.whl (133 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.2/133.2 KB 189.4 MB/s eta 0:00:00[2024-02-21 12:40:39.796267] 
Collecting gitdb<5,>=4.0.1
  Downloading gitdb-4.0.11-py3-none-any.whl (62 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.7/62.7 KB 181.3 MB/s eta 0:00:00[2024-02-21 12:40:39.861168] 
Collecting zipp>=0.5
  Downloading zipp-3.17.0-py3-none-any.whl (7.4 kB)
Collecting pytz>=2020.1
  Downloading pytz-2024.1-py2.py3-none-any.whl (505 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 505.5/505.5 KB 200.5 MB/s eta 0:00:00[2024-02-21 12:40:40.239837] 
Collecting tzdata>=2022.7
  Downloading tzdata-2024.1-py2.py3-none-any.whl (345 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 345.4/345.4 KB 140.2 MB/s eta 0:00:00[2024-02-21 12:40:40.302088] 
Collecting six>=1.5
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting urllib3<3,>=1.21.1
  Downloading urllib3-2.2.1-py3-none-any.whl (121 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.1/121.1 KB 159.0 MB/s eta 0:00:00[2024-02-21 12:40:40.512367] 
Collecting certifi>=2017.4.17
  Downloading certifi-2024.2.2-py3-none-any.whl (163 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 163.8/163.8 KB 173.1 MB/s eta 0:00:00[2024-02-21 12:40:40.575416] 
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.3/140.3 KB 331.9 MB/s eta 0:00:00[2024-02-21 12:40:40.760563] 
Collecting idna<4,>=2.5
  Downloading idna-3.6-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.6/61.6 KB 296.3 MB/s eta 0:00:00[2024-02-21 12:40:40.796670] 
Collecting markdown-it-py>=2.2.0
  Downloading markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.5/87.5 KB 292.0 MB/s eta 0:00:00[2024-02-21 12:40:40.843888] 
Collecting pygments<3.0.0,>=2.13.0
  Downloading pygments-2.17.2-py3-none-any.whl (1.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 387.6 MB/s eta 0:00:00[2024-02-21 12:40:40.896010] 
Collecting smmap<6,>=3.0.1
  Downloading smmap-5.0.1-py3-none-any.whl (24 kB)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28 kB)
Collecting referencing>=0.28.4
  Downloading referencing-0.33.0-py3-none-any.whl (26 kB)
Collecting attrs>=22.2.0
  Downloading attrs-23.2.0-py3-none-any.whl (60 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.8/60.8 KB 270.6 MB/s eta 0:00:00[2024-02-21 12:40:41.205588] 
Collecting rpds-py>=0.7.1
  Downloading rpds_py-0.18.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 335.8 MB/s eta 0:00:00[2024-02-21 12:40:41.630157] 
Collecting jsonschema-specifications>=2023.03.6
  Downloading jsonschema_specifications-2023.12.1-py3-none-any.whl (18 kB)
Collecting mdurl~=0.1
  Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Installing collected packages: pytz, zipp, watchdog, validators, urllib3, tzlocal, tzdata, typing-extensions, tornado, toolz, toml, tenacity, smmap, six, rpds-py, pygments, protobuf, pillow, packaging, numpy, mdurl, MarkupSafe, idna, click, charset-normalizer, certifi, cachetools, blinker, attrs, requests, referencing, python-dateutil, pyarrow, markdown-it-py, jinja2, importlib-metadata, gitdb, rich, pydeck, pandas, jsonschema-specifications, gitpython, jsonschema, altair, streamlit
Successfully installed MarkupSafe-2.1.5 altair-5.2.0 attrs-23.2.0 blinker-1.7.0 cachetools-5.3.2 certifi-2024.2.2 charset-normalizer-3.3.2 click-8.1.7 gitdb-4.0.11 gitpython-3.1.42 idna-3.6 importlib-metadata-7.0.1 jinja2-3.1.3 jsonschema-4.21.1 jsonschema-specifications-2023.12.1 markdown-it-py-3.0.0 mdurl-0.1.2 numpy-1.26.4 packaging-23.2 pandas-2.2.0 pillow-10.2.0 protobuf-4.25.3 pyarrow-15.0.0 pydeck-0.8.1b0 pygments-2.17.2 python-dateutil-2.8.2 pytz-2024.1 referencing-0.33.0 requests-2.31.0 rich-13.7.0 rpds-py-0.18.0 six-1.16.0 smmap-5.0.1 streamlit-1.31.1 tenacity-8.2.3 toml-0.10.2 toolz-0.12.1 tornado-6.4 typing-extensions-4.9.0 tzdata-2024.1 tzlocal-5.2 urllib3-2.2.1 validators-0.22.0 watchdog-4.0.0 zipp-3.17.0

There seems to be no attempt to install plotly. It may be due to one of both of the following:

  1. Streamlit cloud is out of sync with you repository. Delete your application and deploy it again to force streamlit cloud to read the more recent content.
  2. There is something wrong with your requirements file.
1 Like