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
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?
@ashish1 Can you try out the newly-released version 0.3.2 and see if you still experience this issue? I think I figured out and fixed what was causing the issue.
@blackary,
I think I found a fix for the first page not loading when using st-pages.
If you tack on a st.experimental_rerun()
at the end of the script where you are calling all your pages it will reload and it has made it so the first page always loads (for me anyway!).
Let me know if this helps anyone
Ooh, interesting. Does that hide the error message @tubbytim? Also, are you able to see if thatās still required if youāre using version 0.3.2?
So this is how I have it set up:
When I run streamlit run mycoolapp.py
now I never get a blank page, it loads directly into the top page (Which is exactly what I want it to do!). I am not getting any error either, on version 0.3.5 if that helps!
Also, loving the package! It really was a bugbear of mine having to include emojis and whatnot in the python file names!
Does this component support expandable sections? I donāt see anything regarding this so Iām assuming it doesnāt but just wanna make sure
@blackary, pip install st-pages is giving me error. ERROR: Could not find a version that satisfies the requirement st-pages (from versions: none)ERROR: No matching distribution found for st-pages
Nope, sorry. If anyone is interested in adding expanding sections, that could be an interesting addition.
What OS and version of python are you using?
didnāt work in Python 3.7.13, but i upgraded and it worked. Thank you.