I want to deploy a Dash/Plotly application on Renkulab using jupyter-server-proxy similar to the streamlit example described here: How to deploy Streamlit in renku
from jupyter_dash import JupyterDash
JupyterDash.infer_jupyter_proxy_config()
app = JupyterDash(__name__)
(details are defined here...)
if __name__ == "__main__":
app.run_server(mode="jupyterlab", debug=False, port=5000, host='0.0.0.0')
If I call the python script locally it works. However, in Renkulab I receive the following error when starting the session:
Any ideas what could be missing? I also tried a version using gunicorn instead of calling the python script directly (this is for example required when deploying the app on Heroku) with the same result.
Hey @manuelknott can you share a link to the project? If the one where this has been tried contains information you don’t want to share, you can make another one just for testing this.
thanks for pointing out the mismatching ports. I fixed it in the current commit of the minimal example.
However, the “Loading…” issue still remains, and I dug deeper into it:
The main issue is that jupyter_dash works like a charm when being called from a jupyter notebook environment, as this is the library’s main purpose. It does not work when being called from a python file since it is dependent on the jupyter_dash frontend extension.
I tried a couple of things:
Calling a notebook with papermill or nbconvert does not work as the jupyter extensions are not used.
Calling the python script with “jupyter run …” does not work (same issue)
I also tried to not use the above mentioned dependencies but to serve the plain flask app (see the “no_jupyterdash” branch in the example’s repo) → no success so far
There is also a related github issue here.
I tried adding requests_pathname_prefix='/proxy/8050/' to the JupyterDash constructor.
The logs show that the app is running at {host}:8888/proxy/8050, but it is still stuck in the “loading…” phase.
When opening the “lab” environment with my image, I receive a popup that the lab extension “jupyterlab-dash” is missing. Not sure if that would solve anything. Would maybe be worth a try to add it to the Renku Image.