Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 when converting to html with TOC #6224

Open
DawnEve opened this issue Nov 10, 2021 · 2 comments
Open

500 when converting to html with TOC #6224

DawnEve opened this issue Nov 10, 2021 · 2 comments

Comments

@DawnEve
Copy link

DawnEve commented Nov 10, 2021

Describe the bug
500 when converting to html with TOC

To Reproduce

  1. click File - Download as - HTML, it's OK.
  2. click File - Download as - HTML with toc, it's NOT OK.

Expected behavior
No file download, but a new page with large text:

500 : Internal Server Error
The error was:
nbconvert failed: toc2

Screenshots
11

Desktop (please complete the following information):

  • OS: Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-85-generic x86_64) as a server.
  • Browser [chrome] Google Chrome | 91.0.4472.164, as a client on my working PC (windows10).
# on Ubuntu
!pip3 list | grep -i nbconvert
nbconvert                         6.2.0

!pip3 list | grep -i jupyter
jupyter                           1.0.0
jupyter-client                    7.0.6
jupyter-console                   6.4.0
jupyter-contrib-core              0.3.3
jupyter-contrib-nbextensions      0.5.1
jupyter-core                      4.9.1
jupyter-highlight-selected-word   0.2.0
jupyter-latex-envs                1.4.6
jupyter-nbextensions-configurator 0.4.1
jupyter-server                    1.11.1
jupyterlab                        3.2.1
jupyterlab-pygments               0.1.2
jupyterlab-server                 2.8.2
jupyterlab-widgets                1.0.2

Additional context
When using an old version of Jupyter notebook on my win10 PC, I can download HTML with toc.

# on win10
!pip3 list | find "nbconvert"
nbconvert                         5.3.1

!pip3 list | find "jupyter"
jupyter                           1.0.0
jupyter-client                    5.2.3
jupyter-console                   5.2.0
jupyter-contrib-core              0.3.3
jupyter-contrib-nbextensions      0.5.1
jupyter-core                      4.4.0
jupyter-highlight-selected-word   0.2.0
jupyter-latex-envs                1.4.6
jupyter-nbextensions-configurator 0.4.1

Someone on sf suggest using old version of nbconvert, I haven't tried.

@christianbrodbeck
Copy link

christianbrodbeck commented Nov 19, 2022

I have the same issue (on macOS), the server console prints the following. Looks like a template file is missing?

[E 18:14:14.821 NotebookApp] nbconvert failed: toc2
    Traceback (most recent call last):
      File "/Users/christian/anaconda3/envs/mne1/lib/python3.9/site-packages/notebook/nbconvert/handlers.py", line 129, in get
        output, resources = exporter.from_notebook_node(
      File "/Users/christian/anaconda3/envs/mne1/lib/python3.9/site-packages/nbconvert/exporters/html.py", line 223, in from_notebook_node
        return super().from_notebook_node(nb, resources, **kw)
      File "/Users/christian/anaconda3/envs/mne1/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 401, in from_notebook_node
        output = self.template.render(nb=nb_copy, resources=resources)
      File "/Users/christian/anaconda3/envs/mne1/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 157, in template
        self._template_cached = self._load_template()
      File "/Users/christian/anaconda3/envs/mne1/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 371, in _load_template
        return self.environment.get_template(template_file)
      File "/Users/christian/anaconda3/envs/mne1/lib/python3.9/site-packages/jinja2/environment.py", line 1000, in get_template
        return self._load_template(name, globals)
      File "/Users/christian/anaconda3/envs/mne1/lib/python3.9/site-packages/jinja2/environment.py", line 959, in _load_template
        template = self.loader.load(self, name, self.make_globals(globals))
      File "/Users/christian/anaconda3/envs/mne1/lib/python3.9/site-packages/jinja2/loaders.py", line 571, in load
        raise TemplateNotFound(name)
    jinja2.exceptions.TemplateNotFound: toc2
[W 18:14:14.825 NotebookApp] 500 GET /nbconvert/html_toc/Code/Yasmeen%20Aphasia/pipeline/Words-fROI.ipynb?download=true (::1): nbconvert failed: toc2
[E 18:14:14.826 NotebookApp] {
      "Host": "localhost:8888",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
      "Referer": "http://localhost:8888/notebooks/Code/Yasmeen%20Aphasia/pipeline/Words-fROI.ipynb",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15"
    }
[E 18:14:14.826 NotebookApp] 500 GET /nbconvert/html_toc/Code/Yasmeen%20Aphasia/pipeline/Words-fROI.ipynb?download=true (::1) 1001.580000ms referer=http://localhost:8888/notebooks/Code/Yasmeen%20Aphasia/pipeline/Words-fROI.ipynb

Environment info:

% conda list nbconvert
# packages in environment at /Users/christian/anaconda3/envs/mne1:
#
# Name                    Version                   Build  Channel
nbconvert                 7.2.5              pyhd8ed1ab_0    conda-forge
nbconvert-core            7.2.5              pyhd8ed1ab_0    conda-forge
nbconvert-pandoc          7.2.5              pyhd8ed1ab_0    conda-forge

% conda list 'jupyter*'
# packages in environment at /Users/christian/anaconda3/envs/mne1:
#
# Name                    Version                   Build  Channel
jupyter                   1.0.0            py39h6e9494a_7    conda-forge
jupyter_client            7.4.7              pyhd8ed1ab_0    conda-forge
jupyter_console           6.4.4              pyhd8ed1ab_0    conda-forge
jupyter_contrib_core      0.4.0              pyhd8ed1ab_0    conda-forge
jupyter_contrib_nbextensions 0.5.1              pyhd8ed1ab_2    conda-forge
jupyter_core              5.0.0            py39h6e9494a_0    conda-forge
jupyter_highlight_selected_word 0.2.0           py39h6e9494a_1005    conda-forge
jupyter_latex_envs        1.4.6           pyhd8ed1ab_1002    conda-forge
jupyter_nbextensions_configurator 0.4.1              pyhd8ed1ab_2    conda-forge
jupyter_server            1.23.2             pyhd8ed1ab_0    conda-forge
jupyterlab                3.5.0              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_server         2.16.3             pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        3.0.3              pyhd8ed1ab_0    conda-forge
jupytext                  1.14.0             pyheef035f_0    conda-forge

@ehsong
Copy link

ehsong commented Mar 21, 2023

Has this been solved yet? I have the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants