pythonpython-3.xjupyter-notebooknbconvertvoila

No template sub-directory with name 'base' found in the following paths:


I'm trying to run a jupyter notebook using voila on my mac M1. When I run pip3 install voila, the installation succeeds, however, when running voila I get the following error:

Traceback (most recent call last):
  File "/opt/homebrew/bin/voila", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
    app.initialize(argv)
  File "/opt/homebrew/lib/python3.9/site-packages/voila/app.py", line 370, in initialize
    self.setup_template_dirs()
  File "/opt/homebrew/lib/python3.9/site-packages/voila/app.py", line 376, in setup_template_dirs
    self.template_paths = collect_template_paths(['voila', 'nbconvert'], template_name, prune=True)
  File "/opt/homebrew/lib/python3.9/site-packages/voila/paths.py", line 24, in collect_template_paths
    return collect_paths(app_names, template_name, include_root_paths=True, prune=prune, root_dirs=root_dirs)
  File "/opt/homebrew/lib/python3.9/site-packages/voila/paths.py", line 90, in collect_paths
    raise ValueError(
ValueError: No template sub-directory with name 'base' found in the following paths:

I've been trying to work around this by specifying templates from other folders, but currently nothing works.

which voila returns /opt/homebrew/bin/voila

which python3 returns /opt/homebrew/bin/python3

Any thoughts? Thanks


Solution

  • Templates seem to be installed under /opt/homebrew/share/jupyter.

    voila can't find the template dirs in any of the Jupyter location:

    jupyter --paths
    

    One way to fix it is to link to the template dirs to one of the locations voila is looking at (I chose ~/Library/Jupyter based on the output of the above command):

    First make sure the folders exist:

    mkdir -p ~/Library/Jupyter/voila
    mkdir -p ~/Library/Jupyter/nbconvert
    

    Then link the template dirs:

    ln -s /opt/homebrew/share/jupyter/voila/templates ~/Library/Jupyter/voila/templates
    ln -s /opt/homebrew/share/jupyter/nbconvert/templates ~/Library/Jupyter/nbconvert/templates