Streamlit cloud vs local host

Hey, I have notice that when I run Streamlit locally it seem to work quite well but when I try to host the app on the cloud I have experienced a few issues. Once the browser opens my app take quite a while to render content to the screen and once it does if at all it runs extremely slow. With respect to the server side, It seems like the app keeps trying to rerun itself. Since everything is logged and displayed in the terminal I should only see logging of one event for each action. If anyone has any ideas please let me know. The following is a screen shot of what is happing each time i run the app on the cloud. Once again I only experience this while hosting via the cloud which i find to be rather peculiar.

Hi @Jason_Harper,

Thanks for posting!

Can you share the link to your app?

Caroline :balloon:

Hey @Caroline

Thank you so much for getting back to me, I really appreciate it. Unfortunately, the app is currently private because there is sensitive data that can’t be disclosed to the public but my company and I would be happy to work with someone to see if we could provide them some info to help them assist us. Please let me know if this is an option.

Hi @Jason_Harper,

Without looking at the app, I would recommend checking out this blog post on strategies to minimize memory usage. I would also recommend making sure that you’ve included a requirements.txt file that has all of the packages your app is using – if you’re missing packages, the loading process might take longer since the appropriate packages need to be identified and installed.

Best,

Caroline

Hey Caroline,

Thanks for these suggestions. The build process is not too slow. Rather, once the app is built and running, each operation (e.g. clicking a submission button) stalls. From our logging, we can see that the app keeps rerunning, even though nothing is happening in terms of app functionality. Sometimes the app will rerun as many as 20 times before the expected operation completes. Can high memory usage cause this problem? Or do you know of any other reason why this might happen? Moreover, what are the primary differences between hosting locally as oppose to hosting on the cloud when using Streamlit? I think this might help me near the problem down.

Hi @Jason_Harper,

The app shouldn’t be rerunning – again, happy to take a look to see if we can reproduce the behavior. High memory usage shouldn’t cause the app to rerun.

The differences between running a Streamlit app locally vs. deploying it aren’t unique to Streamlit – any time you deploy an app instead of running it locally, the environment that the app is being deployed in might end up being different from the local environment if you have different packages/versions of dependencies installed locally vs. in the container where the app is deployed.

Hope that helps clarify.

Best,

Caroline

Thank you so much @Caroline. This is certainly helpful, I will check that the envs are consistent as well as a few other things and I’ll then let you know how everything worked out once this is done.

1 Like

Hi @Jason_Harper !,
I came across a thread in which you discussed experiencing a similar issue with deploying a Streamlit app on the cloud. I was hoping you could provide some guidance or assistance in resolving the problem I’m currently facing.

I have been trying to deploy my Streamlit application, which analyzes epidemiological data on viral respiratory infections using the file_uploader component. Locally, the app works perfectly fine. However, when attempting to run it in the browser, I encounter various issues that seem to occur randomly.

Here are some of the problems I’ve been facing:

  1. The app fails to recognize column names in data frames, even though they exist. For example, I receive an error message stating: “Value of ‘names’ is not the name of a column in ‘data_frame’.”
  2. The page automatically refreshes but gets stuck between the “running” and “connecting” states.
  3. I consistently encounter the message “We have encountered an unexpected problem. If this issue persists, please contact support.”

I have tried rebooting the app and even completely deleting it and redeploying it, but the errors continue to appear. The app is hosted on GitHub Pages.

The fact that the app runs smoothly locally leads me to believe that the issue may not be with the script itself. Therefore, the error reports are not providing me with much insight into the problem.

I would greatly appreciate any assistance or suggestions you may have regarding this matter. I have provided a link to the GitHub repository below for reference.

https://github.com/lauridangut/boletin_epidemio.git

Thank you in advance for your help. I look forward to hearing from you.

Best regards,

Laura.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.