Attribute Error on Streamlit Cloud

Hello Streamlit Community.

I just released this geospatial weather application that can provide a weather report at each station.

When attempting to duplicate the app using Streamlit-cloud, I received this error:

AttributeError: 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.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script
exec(code, module.dict)
File “/app/geospatial_weather_app/main.py”, line 115, in
app()
File “/app/geospatial_weather_app/main.py”, line 72, in app
location = [np.mean(data.Latitude), np.mean(data.Longitude)]

This function specifically uses Numpy to specify a central location for the folium map.

Any help on this error would be greatly appreciated.

Requirements file

Link to GitHub repo:
Geospatial Weather App on Github

Link to Streamlit-Cloud:
Geospatial Weather App on Streamlit Cloud

There should be more about the AttributeError in the web console.
Maybe data or rather stations_df is empty?
Add some debug code to the app.

Main reason was probably the missing lxml dependency that pandas.read_html() needs.
Then stations_df was empty, because pandas did not read the table.
I forked your github repo, did some refactoring and made a pull request:

Hello @Frank1!

Thank you for taking your time to analyze the attribute error when duplicate my application onto streamlit cloud.

I noticed the refactoring and pull requests, but I have a few inquiries:

  • I confirm [quote=“Franky1, post:3, topic:39188”] lxml [/quote] was missing in requirements.txt file and did not recognize it was a dependency for pandas.
  • In regards to the refactoring I noticed with the ‘main.py’ you placed all the functions on one page and added @st.cache to each. Can streamlit cloud only read applications in this format?

Pandas has a lot of optional dependencies, which are only required, if you use certain functions.
If you use pandas.read_html() you need a html parser. It is not very obvious, but it is described here:

https://pandas.pydata.org/docs/reference/api/pandas.read_html.html

No, i just refactored your app, i pulled the nested functions out of the code and added the caching decorator to the functions to speedup the streamlit app. Might have worked with the previous version too.