Launching Voila from JupyterHub

Hi there Jupyter folks :wave:t2:

I’m pretty new to developing in the JupyterHub environment. I’m looking to use Voila to create a dashboard from a notebook.

From the docs is sounds pretty straightforward. Thus far I have:

  • run voila my_notebook.ipynb from the terminal. This completes successfully and tells me that “Voilà is running at: http://localhost:8866/
  • navigated to https://hub.cryointhecloud.com/user/rwegener2/voila

but I get a 404 not found error. The docs note that

Voilà can also be used as a notebook server extension, both with the notebook server or with the jupyter server.

but I’m not sure I understand how jupyter server fits in, or how it differs from jupyter server proxy. The jupyterhub-jupyter-server-proxy extension is installed on this hub.

So, my primary question is “What am I missing to set up the voila dashboard?”. Right now I am guessing the missing piece is related to my confusion about servers and server proxies.

Thanks so much for any insight others have!

If you have jupyter-server-proxy installed in your single user environment, try to navigate to https://hub.cryointhecloud.com/user/rwegener2/proxy/8866/ (trailing slash is important) assuming your voila dashboard is running at 8866 port.

To access the dashboard using /voila endpoint you need to register the endpoint with jupyter-server-proxy. Here are the docs on how to setup proxy servers

2 Likes

If you’ve installed the extension correctly you shouldn’t need jupyter-server-proxy, nor should you need to run voila from the command line. You should be able to go to /voila instead of /lab in your browser.

How did you install voila? Can you show us your full environment?

3 Likes

Thank you both for the help!

Using hub.cryointhecloud.com/user/rwegener2/proxy/8866/ definitely accesses Voila (progress!), although when testing it on the basics.ipynb voila notebook it spins for >15 minutes on “Executing 6 of 6”. So I’m not sure if that is an issue with the notebook or with the configuration.

I installed voila using conda install -c conda-forge voila. My environment is big, so I’m not allowed to post the full thing in this comment, but a gist with the output of conda list is here.

:pray: thanks again!

1 Like

I came across this the other day with code that had worked before with Voila. In that case it was definitely the Plotly/ipywidgets code in notebook (or current Voila handling that code) and not the configuration. So my guess is that in the case where you are describing something similar is the notebook or how current Voila handles something now that didn’t hang it up before. In my case, I knew that Plotly code embedded in ipywidgets.interactive() had worked before in Voila and so I removed the plotly Plot and then it worked again in a very current Voila and via that experiment I knew it was Plotly or ipywidgets.interactive() or the combination of it with Voila (for the present).

Further complicating diagnosing this all, that basics.ipynb notebook you reference runs perfectly in Voila where I was seeing Plotly hang things up (code is here and you absolutely don’t want the last line a.value=5 included at all because that really just causes Voila to spin without even saying it is executing, even though the code runs fine in Jupyter.). So who knows. (You can test in sessions launched from here if anyone is interested.)

If you run jupyterlab directly from a terminal (without JupyterHub) are you able to access /voila?

Can you also show us your singleuser logs when you start your server via JupyterHub? Amongst other things it should show if Voila was detected

1 Like

Are you looking to run one voila dashboard to use yourself, or do you want multiple users to be able to spawn separate voila dashboards?

Hi, can you please tell me what extension you are talking about here? I am trying to integrate Voila with Jupyterhub (TLJH on custom server), after authentication the user to redirect to voila dashboard. Is this even possible?

if you have voilà installed, you should have a server extension that provides pages at e.g. /user/:name/voila/render/path/to/notebook.ipynb, where /user/:name/lab/tree/path/to/notebook.ipynb would open the notebook in JupyterLab.

So if you have a specific voila notebook that you want to use as your landing page, you can set:

c.Spawner.default_url = "/voila/render/path/to/default-dashboard.ipynb"

Thanks for your answer. Can you please tell me more about this server extension you are talking about? I have installed Voila using pip install voila command on my server.

the server extension is voila, it is part of the voila package. If you have done pip install voila, you have it. jupyter server extension list should show it under vola.server_extension:

Config dir: /opt/conda/etc/jupyter
    ...
    voila.server_extension enabled
    - Validating voila.server_extension...
      voila.server_extension  OK

Thank you. Is this going to support multi users viewing the voila dashboard? And can we have preheated kernels here?

that would be governed by the permissions of the JupyterHub users. If they have the relevant access:servers scope, they will be able to visit the dashboard.

I believe so, you can check the voila documentation.

It looks like setting

c.VoilaConfiguration.preheat_kernel = True

in your jupyter_server_config would enable it. I’m not too familiar with it.