We are attempting to deploy a Streamlit app and are stuck on the “Please wait…” loading message. The following technical details are important:
- Deploying on an Ubuntu 18.04.6
- Streamlit version 1.12.0
- Python version 3.9.7
We are deploying through The Littlest JupyterHub, specifically following this guide after reading about the technique on the forums.
Currently, our command we are using to launch our app is:
streamlit run filepath_to_app/main.py --server.port port_number server.headless True --server.enableCORS False --global.developmentMode False --server.enableWebsocketCompression False --port port_number and yet the issue remains.
We did notice a similar post, but we are already on that python version.
What other configurations do I need to change?
For me the key to running any other web app (streamlit included) via jupyterhub is to employ the package jupyter-server-proxy and use a config file for the notebook.
See here for a complete working example you can test in binder (vscode is the app being proxied): GitHub - ml-starter-packs/microservice-workshop: interactive coding environment for microservices demo
What does my post have to do with microservices? What do you mean “notebook”?
I am having a really hard time understanding your post unfortunately, maybe I just need more information.
It doesn’t, but the architecture there is the same. That was just a repo I used for an educational workshop on the microservice topic, but to enable it I needed to be able to proxy services running in the jupyter container.
Take a look at the requirements, which include “jupyter-server-proxy,” which I think is what you’re missing. Then to access a service at a url, you’d refer to the setup in the jupyter_notebook_config.py file and notice the directory to which it’s copied in the Dockerfile.
The Dockerfile shows a complete example of deploying a web app (vscode) proxied through jupyter, which is the same pattern you need for streamlit.
You’d swap the notebook config file contents to launch your streamlit app instead of starting vscode, then access it at the given url.
Here’s an example leveraging the same pattern but for streamlit (look inside the binder folder for the relevant content): GitHub - ml-starter-packs/mlflow-viz: streamlit app for comparing and visualizing A/B test results from a selection of MLflow runs.
The binder link demonstrates running streamlit through jupyter, which is exactly your use case. Apologies I didn’t think of this repo first, but I thought the completeness of the Dockerfile in the other one would be helpful.
I realized after rereading your comment that youre able to already proxy the process as you see a loading screen, so the error must be in the startup options for streamlit or the versions of packages involved. At the very least, the startup url in the former repo’s config file should help you see how I was able to run streamlit and access it.
Simply this seems to have been enough:
command": [“streamlit”, “run”, “app.py”],
But the build image differs a bit, as may the specific streamlit version (again, all documented in the binder folder)