Deployed app crash w/o error message (maybe issue with cartopy?)

→ GitHub page for app I’m trying to deploy on Streamlit Cloud: GitHub - IsoldeGlissenaar/proCAST

The app works fine locally. When I’m trying to deploy the app it works at first, but when going to the ‘archive’ page I get this message on the page itself (not in the log):

Network issue:
Cannot load Streamlit frontend code. This can happen when you update Streamlit while a Streamlit app is running.
To fix this, simply reload this app by pressing F5, Ctrl+R, or Cmd+R.
If the error persists, try force-clearing your browser’s cache as described here

A few seconds later the app crashes and states:

Oh no.
Error running app. If you need help, try the Streamlit docs and forums.

There are no errors in the log. The other pages of the data app work fine, so I think it might have something to do with the things I load/packages I use in the ‘archive’ page? The page should have sliders, load a netcdf file with xarray, and plot a map using matplotlib and cartopy.

Things I’ve tried:

  • Clearing my browser’s cache as mentioned in the error message.
  • Using another browser
  • Using conda instead of pip for packages installation
  • Deploy the data app without loading the netcdf file with xarray: the problem persists.
  • Plotting with matplotlib and cartopy: the app crashes without giving and error.
  • Just using matplotlib without cartopy: the data app works fine.

So there might be an issue with using Cartopy to plot, but as there is no error messages I don’t really know why.

This is the link to where I try to deploy the app: https://isoldeglissenaar-procast-home-iowef4.streamlit.app/

This project looks familiar to me, it was here on the forum back in December.
I had then cloned the project and had come so far:

Then you didn’t answer anymore and deleted the project on GitHub…

O sorry for not responding! It did really help and thanks so much for your time. I thought it worked after that and didn’t have time to look at it again until a few weeks ago. The project was made private again on Github as I didn’t want the data to be fully public yet.
I did have a look at the possibility of it being an issue with the data like you suggested, but the error persists if I try to do the same plot without loading the data. I thought it would be a good idea to open a new thread because the problem doesn’t link to the original question anymore.

Did you use the Docker environment from my December fork for local testing and debugging? Or at least a virtualenv? Otherwise it will be an endless trial and error if you don’t have a clean local environment.

Phew, this was a tough one… :cold_sweat:

I forked your repo and tried to figure out the problem. At the beginning i got segmentation faults and tons of HDF5 error messages. That’s probably why the streamlit app on streamlit cloud crashed without any noticeable error message. :thinking:

After some research i suspected that the binary python wheels of the different packages have some incompatibilities. So I added the dev headers and forced the suspicious packages to be built by pip from the sources. Et voila, the errors were gone. :sunglasses:

These were probably the crucial changes:

packages.txt

libeccodes-dev
libgeos-dev
libnetcdf-dev
libhdf5-dev

requirements.txt

numpy
pandas
geopandas
eccodes
scipy
xarray --no-binary=xarray
netcdf4 --no-binary=netcdf4
shapely --no-binary=shapely
cartopy --no-binary=cartopy
pyshp
pyproj
matplotlib
plotly
streamlit

See also my fork and pull request:

Btw, without the local Docker test environment, it would have been nearly impossible to ever find these bugs in finite time.

2 Likes

O wow thank you so much! It works like a charm! I don’t think I would have ever figured this out myself, I’ll have to look at those Docker environments (have never used that before).

1 Like

Wow, this is amazing debug skills, and generosity with your time!

Thank you @Franky1!! I had been trying to help @Isolde IRL, but this really stumped us. So, just dropping my appreciate here, especially as it also gives us some insight on how to approach future issues as we deploy our apps.

Such a good forum :smiling_face_with_three_hearts: :partying_face:

1 Like

Hi @Franky1 , I would like to try out a Docker to debug my own issues with the app. How do I set it up in a way to rebuild the Streamlit environment?

Thanks a lot!

The thing is that it gives me an “SError: Error no file named tf_model.h5 or pytorch_model.bin found in directory model/” even though everything should be in place. I thought it might be a similar issue with data formats, which is why I posted it here.

If you want to have a look:
App: https://lid-app.streamlit.app/
Repo: GitHub - Wolftess/LID: A language identification systems working for over 400 languages, including several German dialects like Tyrolean, Swabian and Low Saxon.