Streamlit dashboard works locally but not on cloud.
Here’s my app:
I can’t figure out why. Please help!
Streamlit dashboard works locally but not on cloud.
Here’s my app:
I can’t figure out why. Please help!
Hi @tai_L,
Thanks for sharing your question with the community! Check out our guidelines on how to post an effective question here and pleased edit your question to include a code snippet + link to your app’s GitHub repo
@tai_L there is an issue with your code (line 160) in your file Github_dashboard.py
br2_rent = df_rent_chart['2 bedroom'].iloc[0]
Please debug this yourself by running above that line:
st.write(df_rent_chart['2 bedroom'])
Possible issues:
.iloc[0]
indexing is used to access the first row of the column but the Pandas Series are emptyPlease note if you are trying to access the 1st row of your Pandas Series ‘2 bedroom’ or what your goal is and provide your code or sample please if after debugging it you cannot figure it out. If you found the solution let me know!
Verify the issue is not cookies by using a “private” browsing window.
Hi, I added that line and it looks like the df is coming in empty. It is suppose to read a csv file on a public folder in Github (https://raw.githubusercontent.com/liu3388/RE_input/main/rent.csv). The same script that works on my local drive also pulls in the same csv file from Github. Not sure why it is not reading it after I put it on Github/Streamlit cloud?
@tai_L without seeing your code on e.g. github to debug harder to provide a suggestion.
Locally I have no issues pulling up the dataframe with:
# URL of the CSV file
url = 'https://raw.githubusercontent.com/liu3388/RE_input/main/rent.csv'
# Read the CSV file from the URL
df_rent = pd.read_csv(url)
# Display the DataFrame
st.write(df_rent)
# display the value of last row of column **fmr_2br** in Streamlit
st.write(df_rent['fmr_2br'].iloc[-1])
Currently you have a different error with code in line 168 in file Github_dashboard.py.
File "/app/re_dashboard/Github_dashboard.py", line 168, in <module>
br2_rent = df_rent_chart['2 bedroom'].iloc[-1]
I think you should start debugging if you have the column ‘2 bedroom’ inside your dataframe called df_rent_chart and check for typos.
Please provide a link to your code in github so I can debug it or debug it yourself by printing or st.write() in streamlit the dataframe ‘df_rent_chart’ e.g. st.write(df_rent_chart)
omg I finally figured it out. I was looking for a string variable but the df column is an integer. I was using an ‘isin’ function. Strange thing was, it works fine on my desktop but doesn’t work once I upload into Streamlit cloud. And it was working fine on the Streamlit cloud two weeks ago. I think it is because Streamlit is using Python 3.9 and I have Python 3.8 on my desktop. Tks for all the help!
I had similar issue in the last days, in a line related to the Pandas usage.
Then, I realized in local environment Pandas 1.5.3 was used. But in Streamlit Cloud Pandas 2.0.1 was being installed, even requirements.txt requesting Pandas 1.5.3.
Then I adjusted my code to be compatible with Pandas 2.0.1 and the issue was solved.
The strangest thing for me is the app was running fine for 3 months in the Cloud, then it stopped working suddenly after waking up. In the last weeks, I had 2 similar events (with Altair and Pandas). I am using Streamlit 1.18.1 but it seems changes in other Streamlit builds (1.19, 1.20, etc) crashed my app.
I suggest you to take a look in the logs from Streamlit Cloud and compare them with the module versions installed in your machine. Maybe you need some adjustments.
That was exactly it! I updated my code to be compatible with pandas 2.0.1 and it works fine now!
Samething happened to me – the app was running for months and then it just stopped working!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.