New package st-pages: change page names and icons in sidebar without changing filenames

Ver nice! I will test it now


I am getting this error in my google cloud run streamlit app since I am using st_pages in my app.
I am using python3.10-slim and below is my requirements.txt:
streamlit==1.16.0
st-pages
pandas
pandas-gbq
plotly
cloud-sql-python-connector[pg8000]
streamlit-authenticator

Hi @ashish1, do you experience the same issue locally, or only when deployed to Google Cloud Run?

yes @blackary , its happening with cloud run app only. st-pages is working fine with localhost and even with GCE docker deployment.

I suspect that’s related to this issue New package st-pages: change page names and icons in sidebar without changing filenames - #6 by rickspada, which I don’t have a fix for currently. This may be a limitation of this library for now, in that the very first time someone runs it it has this issue, which may mean it’s not suitable for a lambda-style environment. I’ve added an issue for myself, and hopefully will come up with a fix for this at some point. Contributions welcome if anyone else has a suggested fix.

Thanks @blackary for clarifying this, however for me even sidebar is not loading, I just get some loading message on the homepage and when I see cloud run logs out of range error is there.

My suspicion is that the situation is this:

  • There is a limitation in the st_pages library that on the very first load of the site, it encounters that out of range error
  • For the typical use-case, where the app is essentially a long-running python script, all subsequent loads work fine, so it’s not a big deal
  • In the Google Cloud Run case, every visit to the app is a brand new run of the python script, so every single visit you will encounter that issue

I haven’t invested this use-case extensively, but that’s my best guess. So, if I can figure out a fix to the general issue of the first-time-load error, it will also fix the Google Cloud Run case.

I know this doesn’t resolve the situation for you, but hopefully this explains better what I think is going on.

ok. I think I got it now. Thanks for the detailed clarification @blackary. I will be looking forward to the future releases of the st_pages lib then. Thank you :slight_smile:

1 Like

hello blackary
i am new in the community and i work with streamlit in my project.
for this exemple when i execute the script i don’t have shift between section and the pages inside

Hi @diop95923, welcome to the forum!

Can you clarify – are you just showing an interesting use case of st_pages, or are you experiencing an issue?