voila-dashboards / voila

Voilà turns Jupyter notebooks into standalone web applications
https://voila.readthedocs.io
Other
5.41k stars 503 forks source link

Unable to see widgets #647

Open marketneutral opened 4 years ago

marketneutral commented 4 years ago

I am not able to see any ipywidgets in a voila served notebook. I am running voila version 0.1.21.

The first cell of my notebook (your example) is simply

import ipywidgets as widgets

slider = widgets.FloatSlider(description='$x$', value=4)
text = widgets.FloatText(disabled=True, description='$x^2$')

def compute(*ignore):
    text.value = str(slider.value ** 2)

slider.observe(compute, 'value')

widgets.VBox([slider, text])

I see the widgets fine in the Notebook.

When I start voila, I see no obvious errors related to this

root@af78caa85c46:/tmp/working# voila /tmp/working/notebooks
[Voila] Using /tmp to store connection files
[Voila] Storing connection files in /tmp/voila_9lv5ta76.
[Voila] Serving static files from /opt/conda/lib/python3.7/site-packages/voila/static.
[Voila] Voila is running at:
http://localhost:8866/
[Voila] WARNING | No web browser found: could not locate runnable browser.
ERROR:tornado.general:Could not open static file '/base/images/favicon.ico'
ERROR:tornado.general:Could not open static file '/style/style.min.css'
[Voila] WARNING | Notebook Untitled2-Copy1.ipynb is not trusted
[Voila] Kernel started: 85cebb55-bae9-401a-b537-3de34af4b927
WARNING:tornado.access:404 GET /api/kernels/?1594158156510 (10.254.31.40) 0.50ms

Is there anything else I can check?

jtpio commented 4 years ago

Thanks @marketneutral.

Is there anything else I can check?

Is there anything in the dev tools console in the browser?

marketneutral commented 4 years ago

I am not sure exactly what I am looking at 🤷‍♂️ , but I think that there is no kernel running:

image

As in the Python kernel supporting the notebook did not start. That would seem to contradict the voila startup message ([Voila] Kernel started...), but I could be completely misreading the console.

jtpio commented 4 years ago

Does starting voila with --debug give more info?

marketneutral commented 4 years ago

I should add that I am running this inside a docker container. I start the container with

docker run -it --rm --name voila -u root -v /srv/voila:/tmp/working \
  -v /srv/voila/templates:/opt/conda/share/jupyter/voila/templates \
  -w=/tmp/working -p 8866:8866 -it ds \
  /bin/bash

And then from the bash prompt

 voila /tmp/working/notebooks --debug
root@962b8ae8e503:/tmp/working# voila /tmp/working/notebooks --debug
[Voila] Looking for voila in /etc/jupyter
[Voila] Looking for voila in /usr/local/etc/jupyter
[Voila] Looking for voila in /opt/conda/etc/jupyter
[Voila] Looking for voila in /home/jovyan/.jupyter
[Voila] Looking for voila in /tmp/working
[Voila] using template: default
[Voila] nbconvert template paths:
        /opt/conda/share/jupyter/voila/templates/default/nbconvert_templates
[Voila] template paths:
        /opt/conda/share/jupyter/voila/templates/default/templates
[Voila] static paths:
        /opt/conda/share/jupyter/voila/templates/default/static
        /opt/conda/lib/python3.7/site-packages/voila/static
[Voila] Using /tmp to store connection files
[Voila] Storing connection files in /tmp/voila_hmggn4ws.
[Voila] Serving static files from /opt/conda/lib/python3.7/site-packages/voila/static.
[Voila] serving directory: '/tmp/working/notebooks'
[Voila] Voila is running at:
http://localhost:8866/
[Voila] WARNING | No web browser found: could not locate runnable browser.
[Voila] WARNING | Notebook Untitled2.ipynb is not trusted
[Voila] Found kernel python3 in /opt/conda/share/jupyter/kernels
[Voila] Starting kernel: ['/opt/conda/bin/python3.7', '-m', 'ipykernel_launcher', '-f', '/tmp/voila_hmggn4ws/kernel-8b90620b-c7e5-42ea-b40f-83b44185c0b8.json']
[Voila] Connecting to: tcp://127.0.0.1:59673
[Voila] Connecting to: tcp://127.0.0.1:47535
[Voila] Kernel started: 8b90620b-c7e5-42ea-b40f-83b44185c0b8
[Voila] Kernel args: {'kernel_name': 'python3', 'cwd': '/tmp/working/notebooks'}
[Voila] Applying preprocessor: TagRemovePreprocessor
[Voila] Applying preprocessor: RegexRemovePreprocessor
[Voila] Applying preprocessor: coalesce_streams
[Voila] Applying preprocessor: CSSHTMLHeaderPreprocessor
[Voila] Applying preprocessor: HighlightMagicsPreprocessor
[Voila] Applying preprocessor: VoilaCSSPreprocessor
[Voila] Attempting to load template voila.tpl
[Voila]     template_path: /opt/conda/share/jupyter/voila/templates/default/nbconvert_templates
WARNING:tornado.access:404 GET /api/kernels/?1594736477254 (*<my-ip-address-redacted>*) 0.68ms
[Voila] activity on 8b90620b-c7e5-42ea-b40f-83b44185c0b8: status

The WARNING means it can't connect to the kernel I suppose. This had worked for me several months ago, and I am coming back to it now.

maartenbreddels commented 4 years ago

Strange, it seems like the kernel id is empty, which jinja version do you use?

marketneutral commented 4 years ago

pip freeze gives me this wrt to jinja

Jinja2==2.11.2
jinja2-time==0.2.0