Launching a local session from an image built on Renkulab

Hello,

I followed the documentation for reusing Docker images built on RenkuLab and have successfully managed to use JupyterLab on my laptop running on Ubuntu (and also independently commit and push my changes to remote).

The RenkuLab project in my case is for building a Dash app.

I am able work locally in a JupyterLab interface running at http://127.0.0.1:8888/lab but cannot see anything at the expected http://127.0.0.1:8888/dash endpoint like on renkulab.io.

I get a

500 : Internal Server Error

The error was:
could not start dash in time

And indeed there is no process running a python app.py --port XXXX as can be expected when running the same on renkulab.io.

Any idea what is happening here ?

Hi @champost, I had a look at your project and the trouble is that when the server URL is constructed in app.py it uses an environment variable that isn’t available when you launch the session locally.

This patch should be enough to make it work:

commit d5895a124adbcb1dda531136ab9d92db28eb662a
Author: Rok Roškar <rok.roskar@sdsc.ethz.ch>
Date:   Fri Dec 2 13:37:28 2022 +0000

    chore: fix session url when not on renkulab

diff --git a/app.py b/app.py
index cd6efc4..c03943f 100644
--- a/app.py
+++ b/app.py
@@ -20,7 +20,7 @@ parser.add_argument("--port", type=int)
 args = parser.parse_args()
 
 JupyterDash.infer_jupyter_proxy_config()
-session_url = os.environ.get("SESSION_URL")
+session_url = os.environ.get("SESSION_URL", "http://0.0.0.0")
 proxy_base_path = urlparse(urljoin(session_url + "/", f"proxy/{args.port}/")).path
 app = JupyterDash(requests_pathname_prefix=proxy_base_path)  # initialising dash app
 df = px.data.stocks()  # reading stock price dataset

I was able to get the dash app working with a local session with this change. Hope that helps!

1 Like