8

When I try to download jupyter notebook as HTML with ToC, it gives a

500 Internal Server Error: nbconvert failed: toc2

I have tried to reinstall nbextensions, upgrade notebook, and tried to download notebook with the File>>Download As method and the command method, all with no luck.

jupyter nbconvert --to html_toc names.ipynb

gives the following error

File "C:\Users\Elle\miniconda3\lib\site-packages\jinja2\loaders.py", line 429, in load
    raise TemplateNotFound(name)
jinja2.exceptions.TemplateNotFound: toc2

I was able to download as HTML, but unable to do so with ToC. The toc2 folder is in \miniconda3\share\jupyter\nbextensions. The toc2.tpl is in \miniconda3\Lib\site-packages\jupyter_contrib_nbextensions\templates

I am not sure what steps I should follow to have this work.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Elle
  • 203
  • 2
  • 8

1 Answers1

11

After googling, I fixed it by downgrading nbconvert to version 5.6.1

conda install "nbconvert=5.6.1"
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Elle
  • 203
  • 2
  • 8
  • 9
    This version works, however, there is a need to check into why version 6.0 and above of nbconvert fails to export a notebook as HTML with a table of contents. – Jane Kathambi Mar 09 '21 at 07:32
  • 1
    `conda install -c conda-forge "nbconvert=5.6.1"` – Trenton McKinney Jan 25 '22 at 21:39
  • 3
    Unfortunately, nbconvert `5.6.1` does not work anymore wiht the latest jupyter lab, so this either means no `toc2` in html converts or not using recent jupyter lab. :/ – Alex Jul 25 '22 at 10:46