ideonate / cdsdashboards

JupyterHub extension for ContainDS Dashboards
https://cdsdashboards.readthedocs.io/
Other
201 stars 37 forks source link

Z2JH version: cannot import name 'contextfilter' from 'jinja2' #109

Closed Debilski closed 2 years ago

Debilski commented 2 years ago

Describe the bug When installing the advertised version with helm, rendering with voilà doesn’t seem to work. When clicking on the Deploy as a ContainDS Dashboard button I eventually get the following error

Error report from ContainDS Dashboards

Command Running:

python3 -m voila /home/jovyan/./Untitled.ipynb --port=56613 --no-browser --Voila.base_url=/user/test/dash-untitled-1/ --Voila.server_url=/ --Voila.ip=0.0.0.0 --Voila.tornado_settings allow_origin=172.30.20.9

Error output:

None

Standard output:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/opt/conda/lib/python3.10/runpy.py", line 146, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/opt/conda/lib/python3.10/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "/opt/conda/lib/python3.10/site-packages/voila/__init__.py", line 11, in <module>
    from .server_extension import _load_jupyter_server_extension # noqa
  File "/opt/conda/lib/python3.10/site-packages/voila/server_extension.py", line 21, in <module>
    from .handler import VoilaHandler
  File "/opt/conda/lib/python3.10/site-packages/voila/handler.py", line 24, in <module>
    from .notebook_renderer import NotebookRenderer
  File "/opt/conda/lib/python3.10/site-packages/voila/notebook_renderer.py", line 24, in <module>
    from .exporter import VoilaExporter
  File "/opt/conda/lib/python3.10/site-packages/voila/exporter.py", line 15, in <module>
    from jinja2 import contextfilter
ImportError: cannot import name 'contextfilter' from 'jinja2' (/opt/conda/lib/python3.10/site-packages/jinja2/__init__.py)

To Reproduce

Install version 1.2.0-0.6.3 with helm and click on deploy.

Configuration

My config.yaml follows the one in the docs: https://cdsdashboards.readthedocs.io/en/stable/chapters/setup/z2jh.html#config-yaml

Debilski commented 2 years ago

I was able to work around the issue by maintaining my own copy of ideonate/containds-allr-datascience:0.6.3 on Dockerhub where I’ve added RUN pip install --upgrade "voila==0.3.6". This fixes the issue for my installation.

danlester commented 2 years ago

Thank you for following up.

I haven't had a chance to look into the builds properly, but I'm not sure why it's not just picking up the latest voila anyway: https://github.com/ideonate/cdsdashboards-jupyter-docker/blob/master/voila/Dockerfile

But it's possible the whole stack is slightly out of date or even failing to build.