ipython-contrib/jupyter_contrib_nbextensions

Config option `template_path` not recognized by `LenvsLatexExporter`. Did you mean one of: `template_file, template_name, template_paths`?

ivarzap opened this issue · 79 comments

Several warning messages like the present are shown whenever I open any notebook from jupyter.
I have disabled jupyter_contrib_nbextensions and then uninstalled them.

In all cases, warnings are shown, like in:

[W 18:49:22.283 NotebookApp] Config option template_path not recognized by LenvsHTMLExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.293 NotebookApp] Config option template_path not recognized by LenvsHTMLExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.314 NotebookApp] Config option template_path not recognized by LenvsTocHTMLExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.324 NotebookApp] Config option template_path not recognized by LenvsTocHTMLExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.366 NotebookApp] Config option template_path not recognized by LenvsLatexExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.371 NotebookApp] Config option template_path not recognized by LenvsLatexExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.555 NotebookApp] Config option template_path not recognized by LenvsSlidesExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.562 NotebookApp] Config option template_path not recognized by LenvsSlidesExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.663 NotebookApp] Config option template_path not recognized by LenvsHTMLExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.673 NotebookApp] Config option template_path not recognized by LenvsHTMLExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.694 NotebookApp] Config option template_path not recognized by LenvsTocHTMLExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.704 NotebookApp] Config option template_path not recognized by LenvsTocHTMLExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.746 NotebookApp] Config option template_path not recognized by LenvsLatexExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.752 NotebookApp] Config option template_path not recognized by LenvsLatexExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.911 NotebookApp] Config option template_path not recognized by LenvsSlidesExporter. Did you mean one of: template_file, template_name, template_paths?
[W 18:49:22.917 NotebookApp] Config option template_path not recognized by LenvsSlidesExporter. Did you mean one of: template_file, template_name, template_paths?

I forgot to mention that even after disabling and/or uninstalling, the warnings continue to show.

I have the exactly same problem.

While looking for possible causes, I found one thing:

  • when I downgraded from nbconvert 6.0.3 to 5.6.1, issues are gone - warning are gone and exports started working again
    • use conda install "nbconvert=5.6.1"
  • this probably means, that nbconvert >= 6.00 has significant changes - see here: https://nbconvert.readthedocs.io/en/latest/changelog.html#significant-changes
    • one specially interesting is: template_path has become template_paths - maybe this can be related with the issue

I forgot to mention that even after disabling and/or uninstalling, the warnings continue to show.

One more thing to add, that exports from menu File -> Export Notebook As... are also failing.

I forgot to mention that even after disabling and/or uninstalling, the warnings continue to show.

One more thing to add, that exports from menu File -> Export Notebook As... are also failing.

I have the same issue. After several days to working the annoying problem, deleting and reinstalling, they wont go away. I found this thread when I wanted to open a new issue, so thanks guys for the work around.

xguse commented

Edit: it looks like @stefansimik already said this

I just figured this out.

It has to do with the fact that nbconvert 6.0 changed template_path to template_paths. Until this project changes that you should require nbconvert<6.

This fixed it for me.

I am not sure, where change should happen / what project should be updated...

  • if nbconvert should rollback its changes
  • or other projects depending on nbconvert should update and get in sync with nbconvert

I had the same error and downgrading nbconvert to 5.6.1 helped prevent these errors when running jupyter notebook.
HOWEVER, I am still having trouble with nbextensions. When I open a notebook that previously used to successfully have a table of contents, I am now getting an error:
404 GET /nbextensions/widgets/notebook/js/extension.js?v=20200928130405 (::1) 8.80ms referer=http://localhost:8889/notebooks/Figures.ipynb
(Figures.ipynb is the notebook I am trying to run).
And there is no longer a table of contents tab/option in the notebook (though the collapsible headings seem to be working).

I have searched around for a while now and still no success. Any ideas/help?

Thanks!

UPDATE: the table of contents does show up for a different notebook.
The notebook that it is not showing up in has been the one that I have been mainly using TOC (successfully) in until today.

I had the same error and downgrading nbconvert to 5.6.1 helped prevent these errors when running jupyter notebook.
HOWEVER, I am still having trouble with nbextensions. When I open a notebook that previously used to successfully have a table of contents, I am now getting an error:
404 GET /nbextensions/widgets/notebook/js/extension.js?v=20200928130405 (::1) 8.80ms referer=http://localhost:8889/notebooks/Figures.ipynb
(Figures.ipynb is the notebook I am trying to run).
And there is no longer a table of contents tab/option in the notebook (though the collapsible headings seem to be working).

I have searched around for a while now and still no success. Any ideas/help?

Thanks!

UPDATE: the table of contents does show up for a different notebook.
The notebook that it is not showing up in has been the one that I have been mainly using TOC (successfully) in until today.

Just in my case - I can say, that TOC extension (https://github.com/jupyterlab/jupyterlab-toc) was working correctly all the time, i.e. even before downgrading nbconvert back to v5.6.1
That's why I am not sure, if problem in TOC is directly related to bad version of nbconvert ...

Yes, this issue is related to the change in Nbconvert that replaced 'template_path' with 'template_paths'.

Replacing all instances of 'template_path' with 'template_paths' in the extensions jupyter_latex_envs and jupyter_contrib_nbextensions fixes the error.

I opened pull requests with these changes:
jfbercher/jupyter_latex_envs#58
#1532

If you want to get rid of the error messages before the extensions update, install the extensions from my repos (or clone them) or just replace 'template_path' with 'template_paths' in the local folders of these extensions (in my case these extensions were in ~/miniconda3/lib/python3.8/site-packages/...)

Yes, this issue is related to the change in Nbconvert that replaced 'template_path' with 'template_paths'.

Replacing all instances of 'template_path' with 'template_paths' in the extensions jupyter_latex_envs and jupyter_contrib_nbextensions fixes the error.

I opened pull requests with these changes:
jfbercher/jupyter_latex_envs#58
#1532

If you want to get rid of the error messages before the extensions update, install the extensions from my repos (or clone them) or just replace 'template_path' with 'template_paths' in the local folders of these extensions (in my case these extensions were in ~/miniconda3/lib/python3.8/site-packages/...)

How can I do the replace??

Yes, this issue is related to the change in Nbconvert that replaced 'template_path' with 'template_paths'.
Replacing all instances of 'template_path' with 'template_paths' in the extensions jupyter_latex_envs and jupyter_contrib_nbextensions fixes the error.
I opened pull requests with these changes:
jfbercher/jupyter_latex_envs#58
#1532
If you want to get rid of the error messages before the extensions update, install the extensions from my repos (or clone them) or just replace 'template_path' with 'template_paths' in the local folders of these extensions (in my case these extensions were in ~/miniconda3/lib/python3.8/site-packages/...)

How can I do the replace??

If you want to manually replace all instances of 'template_path' in the files, you can use an editor such as Visual Studio Code or PyCharm. For example, in VS Code:

  1. Use the menu option 'File/Open Folder...' to select the desired folder ('jupyter_contrib_nbextensions', 'jupyter_latex_envs' or 'latex_envs').
  2. Use the menu option 'Edit/Replace in Files' and type 'template_path' and 'template_paths' in the text boxes (without quotes) to replace all occurrences.

I have encountered the same problem. Has anyone solved it now?

Yes, this issue is related to the change in Nbconvert that replaced 'template_path' with 'template_paths'.

Replacing all instances of 'template_path' with 'template_paths' in the extensions jupyter_latex_envs and jupyter_contrib_nbextensions fixes the error.

I opened pull requests with these changes:
jfbercher/jupyter_latex_envs#58
#1532

If you want to get rid of the error messages before the extensions update, install the extensions from my repos (or clone them) or just replace 'template_path' with 'template_paths' in the local folders of these extensions (in my case these extensions were in ~/miniconda3/lib/python3.8/site-packages/...)

Hopefully this pull request can be merged soon - I do have the same problem.

我有完全一样的问题。

在寻找可能的原因时,我发现了一件事:

  • 当我从nbconvert 6.0.3降级到5.6.1时,问题消失了-警告消失了,导出又开始工作了

    • conda install "nbconvert=5.6.1"
  • 这可能意味着nbconvert> = 6.00发生了重大变化-参见此处:https ://nbconvert.readthedocs.io/en/latest/changelog.html#significant-changes

    • 一个特别有趣的是:template_path has become template_paths-也许这可能与问题有关

Hello, I did not solve my problem according to your operation. Is there any other way?

是的,此问题与Nbconvert中将“ template_paths”替换为“ template_paths”的更改有关。
将扩展名jupyter_latex_envs和jupyter_contrib_nbextensions中的'template_paths'替换为'template_paths'的所有实例可修复该错误。
我通过以下更改打开了请求请求:
jfbercher / jupyter_latex_envs#58
#1532
如果要在扩展程序更新之前消除错误消息,请从我的存储库中安装扩展程序(或克隆它们),或者在这些扩展程序的本地文件夹中将“ template_paths”替换为“ template_paths”(在我的情况下,这些扩展名是在〜/ miniconda3 / lib / python3.8 / site-packages / ...)

希望这个拉取请求可以很快合并-我确实有同样的问题。

I solved this problem.First, run pip uninstall nbconvert in Anaconda prompt, and then run conda install "nbconvert = 5.6.1" to solve this problem perfectly!

I solved this problem.First, run pip uninstall nbconvert in Anaconda prompt, and then run conda install "nbconvert = 5.6.1" to solve this problem perfectly!

@outsider-duwen you've downgraded your local version of nbconvert back to 5.6.1.
But is this really the only option to solve that?

If I understood it correct a fix is waiting to be deployed:
I opened pull requests with these changes:
jfbercher/jupyter_latex_envs#58
#1532

I solved this problem.First, run pip uninstall nbconvert in Anaconda prompt, and then run conda install "nbconvert = 5.6.1" to solve this problem perfectly!

@outsider-duwen you've downgraded your local version of nbconvert back to 5.6.1.
But is this really the only option to solve that?

If I understood it correct a fix is waiting to be deployed:
I opened pull requests with these changes:
jfbercher/jupyter_latex_envs#58
#1532

I don't think this is the only solution. I hope you can solve it perfectly. After this bug is fixed, I will try other methods.

Current status of this issue - 2020-10-26

We are waiting for changes in CI configuration:

  • .travis.yml should include tests for Python 3.7 and 3.8 and drop older tests
    • in order this PR #1532 can be accepted
    • currently it fails on CI errors

So how to solve this issue?

So how to solve this issue?

conda install "nbconvert=5.6.1"

reece commented

Yep, or pip install "nbconvert<6"

Because I wasn't using the jupyter-latex-envs extension anyway, I ran pip uninstall jupyter-latex-envs to remove those warnings.

pip uninstall jupyter-latex-envs
Found existing installation: jupyter-latex-envs 1.4.6
Uninstalling jupyter-latex-envs-1.4.6:
  Would remove:
    /home/ryoung/anaconda3/lib/python3.7/site-packages/jupyter_latex_envs-1.4.6.dist-info/*
    /home/ryoung/anaconda3/lib/python3.7/site-packages/latex_envs/*
Proceed (y/n)? y
  Successfully uninstalled jupyter-latex-envs-1.4.6

I found the easiest solution for now was to run:

jupyter notebook --log-level=40

which suppresses warnings, for good or ill.

The solution conda install "nbconvert=5.6.1" worked for me. The 404 errors about "template_path" not recognized went away.

I see several suggestions here to use PIP to solve this problem. Unless you used PIP manually to install nbconvert yourself, then don't uninstall it with PIP; do it with conda or you may corrupt your conda user environment.

I want to caution new Python programmers to NOT use mix pip and conda command line instructions to install and uninstall packages in your base environment, unless you REALLY know what you are doing. You can royally mess up for Anaconda installation to the point where you will be chasing your tail until you completely uninstall and reinstall the entire Anaconda distribution. Always use conda to uninstall packages that were installed with conda ! Pip is not "conda friendly" because it does not reliably update the conda package index.

UPDATE FROM LAST POST ABOUT THIS:

I had the same problem in another conda environment. Using the conda install "nbconvert=5.6.1" was not working; it took forever and never finished. I did a pip uninstall nbconvert in the conda environment. Then I did a conda update --all and that actually installed nbconvert=5.1.3, which is what I needed. So once again conda's integrity-checking algorithm repaired an environment that pip messed up. Very nice.

4/14/2021 UPDATE:
Today with a new conda environment running Python 3.9, the nbconvert=5.6.1 downgrade solution refused to work:

# conda install "nbconvert=5.6.1"
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - nbconvert=5.6.1 -> python[version='>=2.7,<2.8.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.6,<3.7.0a0']

Your python: python=3.9

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

So now I will try the manual hacks that other people in this thread have suggested.

But my question is why does NBconvert need a version of Python < 3.9 ??

- nbconvert=5.6.1 -> python[version='>=2.7,<2.8.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.6,<3.7.0a0']

What "breaking changes" occured in Python 3.9 to make Nbconvert kick up these config option messages in Jupyter ServerApp?

fjdu commented

My solution, which seems to work in my computer, is like this:

Replace template_path with template_paths in the following files:

xxx/anaconda3/lib/python3.x/site-packages/latex_envs/latex_envs.py
xxx/anaconda3/lib/python3.x/site-packages/jupyter_contrib_nbextensions/nbconvert_support/exporter_inliner.py
xxx/anaconda3/lib/python3.x/site-packages/jupyter_contrib_nbextensions/nbconvert_support/toc2.py

I applied the changes that @fjdu suggested but now have a new set of tracebacks and errors showing in the command terminal where I start up a new conda environment called "jlab" running on Jupyter Server 1.5.1 on Windows 10.

# jupyter lab
C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_server\transutils.py:13: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  warnings.warn(warn_msg, FutureWarning)
[I 2021-04-14 00:25:30.587 ServerApp] jupyterlab | extension was successfully linked.
[I 2021-04-14 00:25:30.588 ServerApp] jupyterlab_snippets | extension was successfully linked.
[W 2021-04-14 00:25:30.722 NotebookApp] 'browser' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-04-14 00:25:30.736 ServerApp] The 'min_open_files_limit' trait of a ServerApp instance expected an int, not the NoneType None.
[I 2021-04-14 00:25:30.762 LabApp] JupyterLab extension loaded from C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyterlab
[I 2021-04-14 00:25:30.762 LabApp] JupyterLab application directory is C:\ProgramData\Anaconda3\envs\jlab\share\jupyter\lab
[I 2021-04-14 00:25:30.765 ServerApp] jupyterlab | extension was successfully loaded.
[I 2021-04-14 00:25:30.766 ServerApp] jupyterlab_snippets | extension was successfully loaded.
[I 2021-04-14 00:25:31.104 ServerApp] nbclassic | extension was successfully loaded.
[I 2021-04-14 00:25:31.316 ServerApp] Serving notebooks from local directory: C:\Users\richadmin
[I 2021-04-14 00:25:31.317 ServerApp] Jupyter Server 1.5.1 is running at:
[I 2021-04-14 00:25:31.317 ServerApp] http://localhost:8888/lab?token=3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf
[I 2021-04-14 00:25:31.318 ServerApp]  or http://127.0.0.1:8888/lab?token=3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf
[I 2021-04-14 00:25:31.318 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2021-04-14 00:25:31.329 ServerApp]

    To access the server, open this file in a browser:
        file:///C:/Users/richadmin/AppData/Roaming/jupyter/runtime/jpserver-21148-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf
     or http://127.0.0.1:8888/lab?token=3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf
[I 2021-04-14 00:25:35.522 LabApp] Build is up to date
[E 2021-04-14 00:25:35.807 ServerApp] Uncaught exception GET /api/nbconvert?1618374334927 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/nbconvert?1618374334927', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\tornado\web.py", line 1702, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\tornado\web.py", line 3173, in wrapper
        return method(self, *args, **kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_server\services\nbconvert\handlers.py", line 17, in get
        exporters = base.get_export_names()
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\base.py", line 141, in get_export_names
        e = get_exporter(exporter_name)(config=config)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\base.py", line 102, in get_exporter
        if getattr(exporter(config=config), 'enabled', True):
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_contrib_nbextensions\nbconvert_support\collapsible_headings.py", line 26, in __init__
        super(ExporterCollapsibleHeadings, self).__init__(*args, **kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\templateexporter.py", line 325, in __init__
        super().__init__(config=config, **kw)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\exporter.py", line 108, in __init__
        with_default_config = self.default_config
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_contrib_nbextensions\nbconvert_support\exporter_inliner.py", line 43, in default_config
        if contrib_templates_dir not in template_path:
    NameError: name 'template_path' is not defined
[W 2021-04-14 00:25:35.816 ServerApp] Unhandled error
[E 2021-04-14 00:25:35.817 ServerApp] {
      "Host": "localhost:8888",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0",
      "Accept": "*/*",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "Referer": "http://localhost:8888/lab",
      "Authorization": "token 3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf",
      "X-Xsrftoken": "2|66b403bc|7585b3df62211686fd09f319d8d2136e|1617656094",
      "Content-Type": "application/json",
      "Connection": "keep-alive",
      "Cookie": "username-localhost-8890=\"2|1:0|10:1617759437|23:username-localhost-8890|44:M2VmZjk5NTNlMWI1NDhlZGI5YTA2ZDM4OTJkOGJlN2M=  <<< cookies cut out>>> "",
      "Pragma": "no-cache",
      "Cache-Control": "no-cache"
    }
[E 2021-04-14 00:25:35.820 ServerApp] 500 GET /api/nbconvert?1618374334927 (127.0.0.1) 285.90ms referer=http://localhost:8888/lab
[E 2021-04-14 00:25:35.935 ServerApp] Uncaught exception GET /api/nbconvert?1618374334947 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/nbconvert?1618374334947', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\tornado\web.py", line 1702, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\tornado\web.py", line 3173, in wrapper
        return method(self, *args, **kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_server\services\nbconvert\handlers.py", line 17, in get
        exporters = base.get_export_names()
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\base.py", line 141, in get_export_names
        e = get_exporter(exporter_name)(config=config)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\base.py", line 102, in get_exporter
        if getattr(exporter(config=config), 'enabled', True):
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_contrib_nbextensions\nbconvert_support\collapsible_headings.py", line 26, in __init__
        super(ExporterCollapsibleHeadings, self).__init__(*args, **kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\templateexporter.py", line 325, in __init__
        super().__init__(config=config, **kw)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\exporter.py", line 108, in __init__
        with_default_config = self.default_config
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_contrib_nbextensions\nbconvert_support\exporter_inliner.py", line 43, in default_config
        if contrib_templates_dir not in template_path:
    NameError: name 'template_path' is not defined
[W 2021-04-14 00:25:35.939 ServerApp] Unhandled error
[E 2021-04-14 00:25:35.940 ServerApp] {
      "Host": "localhost:8888",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0",
      "Accept": "*/*",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "Referer": "http://localhost:8888/lab",
      "Authorization": "token 3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf",
      "X-Xsrftoken": "2|66b403bc|7585b3df62211686fd09f319d8d2136e|1617656094",
      "Content-Type": "application/json",
      "Connection": "keep-alive",
      "Cookie": "username-localhost-8890=\"2|1:0|10:1617759437|23:username-localhost-8890|44:M2VmZjk5NTNlMWI1NDhlZGI5YTA2ZDM4OTJkOGJlN2M=<<<COOKIES CUT OUT>>>\"",
      "Pragma": "no-cache",
      "Cache-Control": "no-cache"
    }
[E 2021-04-14 00:25:35.943 ServerApp] 500 GET /api/nbconvert?1618374334947 (127.0.0.1) 409.91ms referer=http://localhost:8888/lab
fjdu commented

I applied the changes that @fjdu suggested but now have a new set of tracebacks and errors showing in the command terminal where I start up a new conda environment called "jlab" running on Jupyter Server 1.5.1 on Windows 10.

# jupyter lab
C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_server\transutils.py:13: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  warnings.warn(warn_msg, FutureWarning)
[I 2021-04-14 00:25:30.587 ServerApp] jupyterlab | extension was successfully linked.
[I 2021-04-14 00:25:30.588 ServerApp] jupyterlab_snippets | extension was successfully linked.
[W 2021-04-14 00:25:30.722 NotebookApp] 'browser' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-04-14 00:25:30.736 ServerApp] The 'min_open_files_limit' trait of a ServerApp instance expected an int, not the NoneType None.
[I 2021-04-14 00:25:30.762 LabApp] JupyterLab extension loaded from C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyterlab
[I 2021-04-14 00:25:30.762 LabApp] JupyterLab application directory is C:\ProgramData\Anaconda3\envs\jlab\share\jupyter\lab
[I 2021-04-14 00:25:30.765 ServerApp] jupyterlab | extension was successfully loaded.
[I 2021-04-14 00:25:30.766 ServerApp] jupyterlab_snippets | extension was successfully loaded.
[I 2021-04-14 00:25:31.104 ServerApp] nbclassic | extension was successfully loaded.
[I 2021-04-14 00:25:31.316 ServerApp] Serving notebooks from local directory: C:\Users\richadmin
[I 2021-04-14 00:25:31.317 ServerApp] Jupyter Server 1.5.1 is running at:
[I 2021-04-14 00:25:31.317 ServerApp] http://localhost:8888/lab?token=3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf
[I 2021-04-14 00:25:31.318 ServerApp]  or http://127.0.0.1:8888/lab?token=3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf
[I 2021-04-14 00:25:31.318 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2021-04-14 00:25:31.329 ServerApp]

    To access the server, open this file in a browser:
        file:///C:/Users/richadmin/AppData/Roaming/jupyter/runtime/jpserver-21148-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf
     or http://127.0.0.1:8888/lab?token=3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf
[I 2021-04-14 00:25:35.522 LabApp] Build is up to date
[E 2021-04-14 00:25:35.807 ServerApp] Uncaught exception GET /api/nbconvert?1618374334927 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/nbconvert?1618374334927', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\tornado\web.py", line 1702, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\tornado\web.py", line 3173, in wrapper
        return method(self, *args, **kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_server\services\nbconvert\handlers.py", line 17, in get
        exporters = base.get_export_names()
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\base.py", line 141, in get_export_names
        e = get_exporter(exporter_name)(config=config)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\base.py", line 102, in get_exporter
        if getattr(exporter(config=config), 'enabled', True):
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_contrib_nbextensions\nbconvert_support\collapsible_headings.py", line 26, in __init__
        super(ExporterCollapsibleHeadings, self).__init__(*args, **kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\templateexporter.py", line 325, in __init__
        super().__init__(config=config, **kw)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\exporter.py", line 108, in __init__
        with_default_config = self.default_config
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_contrib_nbextensions\nbconvert_support\exporter_inliner.py", line 43, in default_config
        if contrib_templates_dir not in template_path:
    NameError: name 'template_path' is not defined
[W 2021-04-14 00:25:35.816 ServerApp] Unhandled error
[E 2021-04-14 00:25:35.817 ServerApp] {
      "Host": "localhost:8888",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0",
      "Accept": "*/*",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "Referer": "http://localhost:8888/lab",
      "Authorization": "token 3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf",
      "X-Xsrftoken": "2|66b403bc|7585b3df62211686fd09f319d8d2136e|1617656094",
      "Content-Type": "application/json",
      "Connection": "keep-alive",
      "Cookie": "username-localhost-8890=\"2|1:0|10:1617759437|23:username-localhost-8890|44:M2VmZjk5NTNlMWI1NDhlZGI5YTA2ZDM4OTJkOGJlN2M=  <<< cookies cut out>>> "",
      "Pragma": "no-cache",
      "Cache-Control": "no-cache"
    }
[E 2021-04-14 00:25:35.820 ServerApp] 500 GET /api/nbconvert?1618374334927 (127.0.0.1) 285.90ms referer=http://localhost:8888/lab
[E 2021-04-14 00:25:35.935 ServerApp] Uncaught exception GET /api/nbconvert?1618374334947 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/nbconvert?1618374334947', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\tornado\web.py", line 1702, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\tornado\web.py", line 3173, in wrapper
        return method(self, *args, **kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_server\services\nbconvert\handlers.py", line 17, in get
        exporters = base.get_export_names()
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\base.py", line 141, in get_export_names
        e = get_exporter(exporter_name)(config=config)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\base.py", line 102, in get_exporter
        if getattr(exporter(config=config), 'enabled', True):
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_contrib_nbextensions\nbconvert_support\collapsible_headings.py", line 26, in __init__
        super(ExporterCollapsibleHeadings, self).__init__(*args, **kwargs)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\templateexporter.py", line 325, in __init__
        super().__init__(config=config, **kw)
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\nbconvert\exporters\exporter.py", line 108, in __init__
        with_default_config = self.default_config
      File "C:\ProgramData\Anaconda3\envs\jlab\lib\site-packages\jupyter_contrib_nbextensions\nbconvert_support\exporter_inliner.py", line 43, in default_config
        if contrib_templates_dir not in template_path:
    NameError: name 'template_path' is not defined
[W 2021-04-14 00:25:35.939 ServerApp] Unhandled error
[E 2021-04-14 00:25:35.940 ServerApp] {
      "Host": "localhost:8888",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0",
      "Accept": "*/*",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "Referer": "http://localhost:8888/lab",
      "Authorization": "token 3a453c2718431429b3612a0561034cae4b3bc355bdf8e1cf",
      "X-Xsrftoken": "2|66b403bc|7585b3df62211686fd09f319d8d2136e|1617656094",
      "Content-Type": "application/json",
      "Connection": "keep-alive",
      "Cookie": "username-localhost-8890=\"2|1:0|10:1617759437|23:username-localhost-8890|44:M2VmZjk5NTNlMWI1NDhlZGI5YTA2ZDM4OTJkOGJlN2M=<<<COOKIES CUT OUT>>>\"",
      "Pragma": "no-cache",
      "Cache-Control": "no-cache"
    }
[E 2021-04-14 00:25:35.943 ServerApp] 500 GET /api/nbconvert?1618374334947 (127.0.0.1) 409.91ms referer=http://localhost:8888/lab

I use jupyter notebook. For jupyterlab, the relevant files might be different.

Yes, this issue is related to the change in Nbconvert that replaced 'template_path' with 'template_paths'.
Replacing all instances of 'template_path' with 'template_paths' in the extensions jupyter_latex_envs and jupyter_contrib_nbextensions fixes the error.
I opened pull requests with these changes:
jfbercher/jupyter_latex_envs#58
#1532
If you want to get rid of the error messages before the extensions update, install the extensions from my repos (or clone them) or just replace 'template_path' with 'template_paths' in the local folders of these extensions (in my case these extensions were in ~/miniconda3/lib/python3.8/site-packages/...)

How can I do the replace??

If you want to manually replace all instances of 'template_path' in the files, you can use an editor such as Visual Studio Code or PyCharm. For example, in VS Code:

  1. Use the menu option 'File/Open Folder...' to select the desired folder ('jupyter_contrib_nbextensions', 'jupyter_latex_envs' or 'latex_envs').
  2. Use the menu option 'Edit/Replace in Files' and type 'template_path' and 'template_paths' in the text boxes (without quotes) to replace all occurrences.

This solution worked for me. In my case I opened C:\Users<username>\miniconda3\envs<env-name>\Lib\site-packages\latex_envs and ...\jupyter_contrib_nbextensions in VSCode and did the find/replace all.

Yes, this issue is related to the change in Nbconvert that replaced 'template_path' with 'template_paths'.

Replacing all instances of 'template_path' with 'template_paths' in the extensions jupyter_latex_envs and jupyter_contrib_nbextensions fixes the error.

I opened pull requests with these changes:
jfbercher/jupyter_latex_envs#58
#1532

If you want to get rid of the error messages before the extensions update, install the extensions from my repos (or clone them) or just replace 'template_path' with 'template_paths' in the local folders of these extensions (in my case these extensions were in ~/miniconda3/lib/python3.8/site-packages/...)

I can confirm that these changes have fixed the warning messages on my setup (MacOS 10.14.6, miniforge3, Python 3.9, jupyter_contrib_nbextensions 0.5.1).

if anyone have the same issue and if you dont want those errors to rasie ,,, just execute this and dont update nbconvert again.... "pip install nbconvert==5.6.1"..

The solution conda install "nbconvert=5.6.1" worked for me. The 404 errors about "template_path" not recognized went away.

I see several suggestions here to use PIP to solve this problem. Unless you used PIP manually to install nbconvert yourself, then don't uninstall it with PIP; do it with conda or you may corrupt your conda user environment.

I want to caution new Python programmers to NOT use mix pip and conda command line instructions to install and uninstall packages in your base environment, unless you REALLY know what you are doing. You can royally mess up for Anaconda installation to the point where you will be chasing your tail until you completely uninstall and reinstall the entire Anaconda distribution. Always use conda to uninstall packages that were installed with conda ! Pip is not "conda friendly" because it does not reliably update the conda package index.

UPDATE FROM LAST POST ABOUT THIS:

I had the same problem in another conda environment. Using the conda install "nbconvert=5.6.1" was not working; it took forever and never finished. I did a pip uninstall nbconvert in the conda environment. Then I did a conda update --all and that actually installed nbconvert=5.1.3, which is what I needed. So once again conda's integrity-checking algorithm repaired an environment that pip messed up. Very nice.

4/14/2021 UPDATE:
Today with a new conda environment running Python 3.9, the nbconvert=5.6.1 downgrade solution refused to work:

# conda install "nbconvert=5.6.1"
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - nbconvert=5.6.1 -> python[version='>=2.7,<2.8.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.6,<3.7.0a0']

Your python: python=3.9

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

So now I will try the manual hacks that other people in this thread have suggested.

But my question is why does NBconvert need a version of Python < 3.9 ??

- nbconvert=5.6.1 -> python[version='>=2.7,<2.8.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.6,<3.7.0a0']

What "breaking changes" occured in Python 3.9 to make Nbconvert kick up these config option messages in Jupyter ServerApp?

i have the same problem, i run the command conda install "nbconvert<6" and choose the version 5.5.0 solve this problem

So at present, this problem is still not fixed? 😂

Still not fixed
Jupyterlab's console is full of errors 🙏😭

For those looking for a temporary quick-fix, I made a new environment in Anaconda using Python 3.8.12 and everything installed quickly and runs perfectly.

So it seems like Lenvs either cant refactor their code to add an s to template_path or doesn't want to? This is 1.25 year's old and seems like it should be an easy fix? But the only solution is that we can roll back nbconvert to a old version?

So it seems like Lenvs either cant refactor their code to add an s to template_path or doesn't want to? This is 1.25 year's old and seems like it should be an easy fix? But the only solution is that we can roll back nbconvert to a old version?

If I understand it correctly, you are right. It is still not solved problem and we have to roll back nbconvert to an old version right now.

Pull request to fix this already exists:

@demotu wrote:
I opened pull requests with these changes:

but it cannot run without some CI dependent errors (don't know details), so it was not merged yet.
That's the problem.

I've been able to resolve this rather easily in 2 steps:

  1. Update the jupyter_contrib_nbextensions repo manually as detailed in the docs here. This is important because the normal install via pip (don't know about conda but I think it should be the same) will install release 0.5.1 which is several commits behind and does not include the merged patch #1532.
  2. Edit the file site-packages/latex_envs/latex_envs.py replacing all template_path with template_paths, use the PR jfbercher/jupyter_latex_envs#58 as reference. Unfortunately the patch is not yet merged, but it's a simple fix that can be done locally.

AFAICT this is working with no obvious side effect. For posterity, I've updated jupyter_contrib_nbextensions to commit a186b18.

Cheers!

Still not working

Still not working

Exactly, I can confirm, still not working.

I use this (not great) workaround..

## Install nbextensions for convenient snippets
# the last three lines are a temporary fix to a version mismatch with nbconvert https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/1529
RUN pip3 install --user jupyter_contrib_nbextensions \
&& jupyter contrib nbextension install --user \
&& jupyter nbextension enable --user snippets/main \
&& pip3 uninstall jupyter-latex-envs -y \
&& sed -i 's/template_path/template_paths/g' /home/lpe/.local/lib/python3.8/site-packages/jupyter_contrib_nbextensions/nbconvert_support/toc2.py \
&& sed -i 's/template_path/template_paths/g' /home/lpe/.local/lib/python3.8/site-packages/jupyter_contrib_nbextensions/nbconvert_support/exporter_inliner.py

The solution for us was to downgrade the version of notebook.
We have this problem with the plugin cite2c ( https://github.com/takluyver/cite2c)
Came back to a version <= 6.2.0 for jupyter notebook solved the problem.
By the anaconda navigator need to select the appropriate version (see screenshot)
Screenshot 2022-04-07 at 16 36 31

As you can see, i run with nbconvert at 6.0.7

jupyter core : 4.7.1
jupyter-notebook : 6.2.0
qtconsole : 5.0.2
ipython : 7.21.0
ipykernel : 5.3.4
jupyter client : 6.1.7
jupyter lab : 3.0.12
nbconvert : 6.0.7
ipywidgets : 7.5.0
nbformat : 5.0.8
traitlets : 5.0.5

fip17 commented

Thanks for all the great ideas. No resolution here. Still a problem on startup of JupyterLab.

Looks like jfbercher/jupyter_latex_envs#58 was just merged. Seems it is not yet updated on pypi, but installing the master branch using e.g. pip install git+https://github.com/jfbercher/jupyter_latex_envs.git (this might require a pip uninstall jupyter_latex_envs first) appears to finally fix this issue. You will also have to install the master branch of jupyter_contrib_nbextensions so that the #1532 pull request is included, using e.g. pip install git+https://github.com/ipython-contrib/jupyter_contrib_nbextensions.git (see also the above comment).

It's July 2022 now and the version of nbconvert has been upgraded to 7.0.0, has the problem been fixed by the developers? I tried so many times before and even made my environment collapsed several times, so I choose not to take the risk this time :(

It's July 2022 now and the version of nbconvert has been upgraded to 7.0.0, has the problem been fixed by the developers? I tried so many times before and even made my environment collapsed several times, so I choose not to take the risk this time :(

I am also interested, situation is quite unreadable for me too.

I have removed the dependency on jupyter_latex_envs now in PR #1601. I will make a release in the next days, so the error messages should not cotinue to pop up in a news installation. You can still manually install the jupyter_latex_envs extension manually from jfbercher's the master branch.

Yeah, I think the problem still exists, so I decided to downgrade the nbconvert to 5.6.1 again. Fortunately, no side-effect was caused this time.

kamua commented

I'm tested @lukelbd's tips. Currently, this command sequence installs the Jupyter notebook extensions without any errors:

pip install git+https://github.com/ipython-contrib/jupyter_contrib_nbextensions.git
pip install git+https://github.com/jfbercher/jupyter_latex_envs.git
jupyter contrib nbextension install --user

Thank you, @lukelbd!

@kamua
I tested it with the 3 lines above, and it DOES NOT REALLY work.
I mean, it really installs nicely without any error - but at the end - export in html_toc format does NOT work correctly.

I tested it with latest jupyterlab v3.4.5

I am attaching both files:

  • input file - test.ipynb
  • output html file - test.html - you can see, there is text None, instead of the Table of Content

Both files in attached zip:
test.zip

kamua commented

@stefansimik Yes, you're right, export to html_toc format doesn't work properly (I'm just checked). I'm just saying that the issue described in the first post of the topic has been fixed. I think that uncorrect exporting in html_toc format is an inssue of the nbconvert package but not jupyter-contrib-nbextensions.

@stefansimik Yes, you're right, export to html_toc format doesn't work properly (I'm just checked). I'm just saying that the issue described in the first post of the topic has been fixed. I think that uncorrect exporting in html_toc format is an inssue of the nbconvert package but not jupyter-contrib-nbextensions.

Thank you @kamua for checking it and analyzing problem.
I think, you are right, it is problem of nbconvert now.

I reported the problem about nbconvert here:
jupyter/nbconvert#1835

Despite trying all the solutions in this thread and even reinstalling in a new config, I still ran into this issue. I thought it could be some config somewhere. So I used:

jupyter --paths

to list all the config directories used by jupyter, and then I searched for the string template_path. Turns out there was an old config that defined template_path in jupyter_nbconvert_config.json. Removing those lines fixed the issue for me.

Downgrading worked for me:
conda install -c conda-forge nbconvert==5.6.1

Downgrading worked for me: conda install -c conda-forge nbconvert==5.6.1

Yes, the command itself can run successfully, but with many negative effects:

  • global downgrading of many libraries, which is not acceptable for man projects with fixed dependencies
  • many functionalities after deeper testing do not work - see comments above: 'export to html_toc format doesn't work properly'

Downgrading worked for me: conda install -c conda-forge nbconvert==5.6.1

Yes, the command itself can run successfully, but with many negative effects:

  • global downgrading of many libraries, which is not acceptable for man projects with fixed dependencies
  • many functionalities after deeper testing do not work - see comments above: 'export to html_toc format doesn't work properly'

Yes, I saw that. I work on it within an env and test for now how things work in practice. I will post updates when I experience some particular troubles. Thanks!

In my case the packages that got downgraded after I downgraded nbconvert are:

  jinja2             pkgs/main/win-64::jinja2-3.1.2-py39ha~ --> conda-forge/noarch::jinja2-2.11.3-pyhd8ed1ab_2
  jupyter_server     pkgs/main/win-64::jupyter_server-1.18~ --> conda-forge/noarch::jupyter_server-1.13.5-pyhd8ed1ab_0
  markupsafe         pkgs/main::markupsafe-2.1.1-py39h2bbf~ --> conda-forge::markupsafe-2.0.1-py39hb82d6ee_1
  nbconvert          pkgs/main/win-64::nbconvert-6.5.4-py3~ --> conda-forge/noarch::nbconvert-5.6.1-pyhd8ed1ab_2
  notebook           pkgs/main/win-64::notebook-6.5.2-py39~ --> conda-forge/noarch::notebook-6.4.12-pyha770c72_0

So not a big deal I guess, but how long do we still have to wait for this to get properly fixed?
Also, where exactly should we report the problems involving template_path and export to html_toc to help expedite their resolution?

UPDATE: I talked too soon! Apparently downgrading nbconvert didn't fix it completely! I'm still seeing the following errors:

[W 14:19:26.447 NotebookApp] Config option `extra_template_paths` not recognized by `ExporterCollapsibleHeadings`.  Did you mean `template_path`?
[W 14:19:26.479 NotebookApp] Config option `extra_template_paths` not recognized by `TocExporter`.  Did you mean `template_path`?
[I 14:19:29.312 NotebookApp] Kernel started: 1eb06ccc-03a9-4659-b53b-2c6adad119dc, name: python3
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control
[IPKernelApp] WARNING | No such comm: bbdc794c-6618-4c94-9997-a8b02b94b982

The only difference is I'm just seeing a single occurrence of that and not multiple errors as OP reported.
What should I do?

(Note for myself: I encountered this problem while trying to install Disco Diffusion)

@illtellyoulater
You summarized it very nicely, I am locked in exactly the same problem
and I would really welcome anyone, who could bring some more light, how to solve this finally.

There is a new release that should solve the problems on PyPi. Unfortunately, the maintainer of the conda-forge packages is no longer active. We are trying to fix this, so the update will be available through conda, too.

in my case, installing "nbconvert<6" gives 500 error when I try to open a notebook -- now I am back to v. nbconvert-7.2.9

in my case, installing "nbconvert<6" gives 500 error when I try to open a notebook -- now I am back to v. nbconvert-7.2.9

Exactly, I have to confirm the same problem.

01_JupyterLab_Save_and_Export_Notebook_as_Html_toc

02_ErrorMessage_500_nbconvert_toc2 tpl_failed

03_ErrorMessage_AnacondaPrompt_nbconvert_toc2 tpl_failed

Exporting as HTML_TOC is simply still not working as one piece of functional software.
People in Jupyter community somehow cannot fix this for almost 2 years.

It seems like the problem persists in nbconvert==7.2.9 and jupyter-notebook==6.5.2.
Downgrading to nbconvert==5.6.1 is not a suitable solution anymore as the version 5.6.1 was last updated in 2019.
(unless you are comfortable with living in 2019 with many outdated dependencies)
I'm quite surprised to see how such a simple error could persist for more than 4 years.

It seems like the problem persists in nbconvert==7.2.9 and jupyter-notebook==6.5.2. Downgrading to nbconvert==5.6.1 is not a suitable solution anymore as the version 5.6.1 was last updated in 2019. (unless you are comfortable with living in 2019 with many outdated dependencies) I'm quite surprised to see how such a simple error could persist for more than 4

Excellently summed and explained 👍
Sadly, I have to confirm each word.

So it looks like you have got a stale config file for nbconvert.
Try this:
jupyter nbconvert --show-config

This will show you the used configuration file and the configuration. Either edit it to remove the offending stuff or delete it.

So it looks like you have got a stale config file for nbconvert. Try this: jupyter nbconvert --show-config

This will show you the used configuration file and the configuration. Either edit it to remove the offending stuff or delete it.

Hi juhasch, thank you for your quick reply.
This is the content of my nbconvert_config.json (what i get when I type jupyter nbconvert --show-config)
Am I missing something here?

Loaded config files:
  [Path_to_my_env]/etc/jupyter/jupyter_nbconvert_config.json

Exporter
  .extra_template_paths = [   '.',
    '[Path_to_my_env]/lib/python3.10/site-packages/jupyter_contrib_nbextensions/templates']
  .preprocessors = [   'jupyter_contrib_nbextensions.nbconvert_support.CodeFoldingPreprocessor',
    'jupyter_contrib_nbextensions.nbconvert_support.PyMarkdownPreprocessor']

This configuration adds support for the notebook extensions to nbconvert. If you don't need it, simply remove the config file, or at least all entries that contain nbextensions.

This configuration adds support for the notebook extensions to nbconvert. If you don't need it, simply remove the config file, or at least all entries that contain nbextensions.

Even after deleting jupyter_nbconvert_config.json file, the problem persists.

I landed here after encountering a bunch of template_path errors, the first of which is

Config option `template_path` not recognized by `ExporterCollapsibleHeadings`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?

my jupyter environment versions:

$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.11.0
ipykernel        : 6.21.2
ipywidgets       : not installed
jupyter_client   : 8.0.3
jupyter_core     : 5.2.0
jupyter_server   : 2.0.0
jupyterlab       : not installed
nbclient         : 0.7.2
nbconvert        : 7.2.9
nbformat         : 5.7.3
notebook         : 6.2.0
qtconsole        : not installed
traitlets        : 5.9.0

My objective is to run jupyter notebook with nbextensions, TOC2 in particular. I encountered a bunch of weird version incompatibilities leading to 500 server errors or the table of contents showing up blank. As of the versions shown above, my TOC2 setup appears to be working, even though I get 20+ lines of template_path warnings when I open my notebooks. With the caveat that I don't use any of the export functions and haven't tried any, here's a script I used to get rid of the warnings:

#!/usr/bin/env bash

DRY_RUN=0  # change to 1 to just print the changes
SITE_PACKAGES_DIR=$(python -c 'import site; print(site.getsitepackages()[0])')

patch-template-paths-with-backup() {
    _target_relpath=$1
    _target_file=$SITE_PACKAGES_DIR/$_target_relpath
    _backup_file=$_target_file.orig
    if [ -e $_backup_file ]; then
        echo "WARN: $_backup_file exists; assuming patch is already completed"
        return
    fi

    SED_STRING='s/\btemplate_path\b/template_paths/g'

    if [ $DRY_RUN -eq 1 ]; then
        cat $_target_file |
            sed $SED_STRING |
            diff -Naur $_target_file -
        read
    else
        set -x
        mv $_target_file $_backup_file
        set +x
        cat $_backup_file |
            sed $SED_STRING |
            cat > $_target_file
    fi
}

FILES_TO_CONVERT=(
    jupyter_contrib_nbextensions/config_scripts/highlight_html_cfg.py
    jupyter_contrib_nbextensions/config_scripts/highlight_latex_cfg.py
    jupyter_contrib_nbextensions/install.py
    jupyter_contrib_nbextensions/nbconvert_support/exporter_inliner.py
    jupyter_contrib_nbextensions/nbconvert_support/toc2.py
    jupyter_contrib_nbextensions/nbextensions/runtools/readme.md
    jupyter_core/tests/dotipython_empty/profile_default/ipython_nbconvert_config.py
    latex_envs/latex_envs.py
);

for file_to_convert in ${FILES_TO_CONVERT[@]}; do
    echo $file_to_convert
    patch-template-paths-with-backup $file_to_convert
done

save this to a bash script in the venv and run it. Restart the server, and the template_path warnings disappear. Maybe we're sweeping something under the rug. Don't know, but the terminal output is cleaner for now. Use at your own risk.

Notice the date ......... This problem still exists
[W 04:27:59.481 NotebookApp] Config option template_path not recognized by LenvsLatexExporter. Did you mean one of: extra_template_paths, template_name, template_paths?

Has anyone found a workaround for this issue?

Has anyone found a workaround for this issue?

No, it is still a problem 🙏

Im having this for years.
remembering some errors, could it be an issue about the config files being upgraded to some new notebook version, hence template version, (later also jup lab)
and so from that point the modified "app" and "server" links are messed up,
like from that "NotebookApp" to "NotebookServer" turnover, or was it visa versa,
or the obsoletes cause this error waterfall.
Just dropping in an idea. Maybe someone sees a light.

I don't see the problem in Jupyter delivered with anaconda (in a virtual environment specially created to check this). Somehow, ananconda has solved the problem and their solution is implicit in anaconda package version numbers. In particuler, nbconvert is 6.5.4.

I don't see the problem in Jupyter delivered with anaconda (in a virtual environment specially created to check this). Somehow, ananconda has solved the problem and their solution is implicit in anaconda package version numbers. In particuler, nbconvert is 6.5.4.

@palbarede
You should be more specific about exact versions (Anaconda, Python installed, libraries), otherwise nobody really knows, what you have installed.

conda --version
conda env export

Today, I met the same questions.

Today, I met the same questions.

I stumbled on the same issue today. It's 2023 so reverting nbconvert back to pre 6.0 version is probably not the optimal option. Instead, I tried the following:

  1. Locate the file templateexporter.py in your python env. For me, it is under miniforge3/envs/nlp/lib/python3.9/site-packages/nbconvert You should replace my nlp with your venv name.
  2. Find the following lines:before
  3. Define extra variables template_path, extra_template_path, and extra_template_basedir as the following:after

After adding these extra definitions, the Config option template_path.... does not show up anymore. So it seems to work. This is just a workaround. Hopefully someone could come up with a fix to this problem.

pxpwoa commented

upgrade nbconvert to 7.6.0 version solves my problem.

upgrade nbconvert to 7.6.0 version solves my problem.
Unfortunately for me the problem persists with nbconvert=7.6.0. So I went back to my hackish solution...

Modifying nbconvert/exporters/templateexporter.py as suggested by @chang48 has the unfortunate side effect that some of nbconvert's TemplateExporters like HTMLExporter cannot find the templates such as lab or classic anymore, resulting in the following error (e.g., when doing nbconvert.HTMLExporter().from_notebook_node(nb, resources)):

jinja2.exceptions.TemplateNotFound: index.html.j2

The cleanest solution seems therefore to only modify latex_envs/latex_envs.py by replacing template_path with template_paths, as this outdated package1 seems to be the culprit, as noted by several commenters above.

Footnotes

  1. Note that it's outdated on conda-forge. The original repository replaced template_path with template_paths already in Sept. 2020. Hence, you could as well just replace your latex_envs.py with the upstream latex_envs.py.