ipython-contrib / jupyter_contrib_nbextensions

A collection of various notebook extensions for Jupyter
http://jupyter-contrib-nbextensions.readthedocs.io/en/latest
Other
5.2k stars 806 forks source link

replace template_path with template_paths #1532

Closed demotu closed 3 years ago

demotu commented 3 years ago

Nbconvert 6.0 replaced 'template_path' with 'template_paths' (see https://nbconvert.readthedocs.io/en/latest/changelog.html#significant-changes). This change in Nbconvert causes errors in jupyter_latex_envs and in jupyter_contrib_nbextensions (see https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/1529).

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

demotu commented 3 years ago

Update changelog file with the changes of pr #1532

stefansimik commented 3 years ago

Update changelog file with the changes of pr #1532

I appreciate the PR. Some CI checks are still failing, for example with this error:

ERROR: Could not find a version that satisfies the requirement nbconvert>=6.0 (from jupyter-contrib-nbextensions==0.5.1) (from versions: 4.0.0, 4.1.0, 4.2.0, 4.3.0, 5.0.0b1, 5.0.0, 5.1.0, 5.1.1, 5.2.1, 5.3.0, 5.3.1, 5.4.0, 5.4.1.dev0, 5.4.1, 5.5.0, 5.6.0, 5.6.1)
ERROR: No matching distribution found for nbconvert>=6.0 (from jupyter-contrib-nbextensions==0.5.1)

Would you be so kind please and could check why it cannot pass?

demotu commented 3 years ago

Update changelog file with the changes of pr #1532

I appreciate the PR. Some CI checks are still failing, for example with this error:

ERROR: Could not find a version that satisfies the requirement nbconvert>=6.0 (from jupyter-contrib-nbextensions==0.5.1) (from versions: 4.0.0, 4.1.0, 4.2.0, 4.3.0, 5.0.0b1, 5.0.0, 5.1.0, 5.1.1, 5.2.1, 5.3.0, 5.3.1, 5.4.0, 5.4.1.dev0, 5.4.1, 5.5.0, 5.6.0, 5.6.1)
ERROR: No matching distribution found for nbconvert>=6.0 (from jupyter-contrib-nbextensions==0.5.1)

Would you be so kind please and could check why it cannot pass?

The problem is that nbconvert 6.1 dropped support for Python 3.6 (https://nbconvert.readthedocs.io/en/latest/install.html#supported-python-versions) and all the CI checks are for Python < 3.7. Since the current versions of Python and nbconvert in the default Anaconda Installers are now 3.8 and 6.1 (I think), I'd argue that jupyter_contrib_nbextensions default release should also be compatible with these versions. So, .travis.yml should include tests for Python 3.7 and 3.8 and drop older tests (at least for the latest version).

demotu commented 3 years ago

Update changelog file with the changes of pr #1532

I appreciate the PR. Some CI checks are still failing, for example with this error:

ERROR: Could not find a version that satisfies the requirement nbconvert>=6.0 (from jupyter-contrib-nbextensions==0.5.1) (from versions: 4.0.0, 4.1.0, 4.2.0, 4.3.0, 5.0.0b1, 5.0.0, 5.1.0, 5.1.1, 5.2.1, 5.3.0, 5.3.1, 5.4.0, 5.4.1.dev0, 5.4.1, 5.5.0, 5.6.0, 5.6.1)
ERROR: No matching distribution found for nbconvert>=6.0 (from jupyter-contrib-nbextensions==0.5.1)

Would you be so kind please and could check why it cannot pass?

The problem is that nbconvert 6.1 dropped support for Python 3.6 (https://nbconvert.readthedocs.io/en/latest/install.html#supported-python-versions) and all the CI checks are for Python < 3.7. Since the current versions of Python and nbconvert in the default Anaconda Installers are now 3.8 and 6.1 (I think), I'd argue that jupyter_contrib_nbextensions default release should also be compatible with these versions. So, .travis.yml should include tests for Python 3.7 and 3.8 and drop older tests (at least for the latest version).

To correct myself, the current version of nbconvert is 6.0.7, and according to its documentation: "nbconvert 6.0 provides limited support for Python 3.6. nbconvert 6.1 will drop support for Python 3.6. Limited support means we will test and run CI on Python 3.6.12 or higher. Issues that are found only affecting Python 3.6 are not guaranteed to be fixed. We recommend all users of nbconvert use Python 3.7 and higher."

stefansimik commented 3 years ago

Hi @demotu in reference to:

So, .travis.yml should include tests for Python 3.7 and 3.8 and drop older tests

Do you have any idea, who could be capable / allowed doing this for this repo?

demotu commented 3 years ago

Hi @demotu in reference to:

So, .travis.yml should include tests for Python 3.7 and 3.8 and drop older tests

Do you have any idea, who could be capable / allowed doing this for this repo?

I think we just have to change the .travis.yml file; I will do that in my fork and I let you know.

One detail is that I think the warning messages shown in https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/1529#issue-703755642 are in fact generated by the jupyter_latex_envs extension, which has also to change to 'template_paths' (related pull request there, jfbercher/jupyter_latex_envs#58). So, even after you accept the pull request here, the warning messages will still appear until jupyter_latex_envs also accept the PR there (and any other extension using 'template_path' instead of 'template_paths' and someway linked to nbconvert, but it seems to be just these two extensions).

proinsias commented 3 years ago

@demotu / @stefansimik – any update on this?

stefansimik commented 3 years ago

@demotu / @stefansimik – any update on this?

Only @demotu can save us :-)

demotu commented 3 years ago

promise I will do it in two days.

demotu commented 3 years ago

I didn't notice I was also committing to master all the time. Some of the previous CI tests failed for strange reasons, but jupyter_contrib_nbextensions '0.5.2' runs fine in my local installation with linux, miniconda, python 3.8.6 and notebook 6.1.5. let's see the latest CI tests.

demotu commented 3 years ago

Most of the CI tests fail with message (https://travis-ci.org/github/ipython-contrib/jupyter_contrib_nbextensions/jobs/747348271): jinja2.exceptions.TemplateNotFound: ...

It seems it's a common error using jinja2, e.g.: https://www.google.com/search?q=jinja2.exceptions.TemplateNotFound

I will try to fix.

marhoy commented 3 years ago

Any plans for merging this?

stefansimik commented 3 years ago

Any plans for merging this? Yeah, that would be awesome. I am also waiting for this merge, checking weekly 😉

juhasch commented 3 years ago

Sorry for the long wait. Merging and trying to fix the CI tests afterwards.

stefansimik commented 2 years ago

Thank you @juhasch Looks like it is not an easy task to fix the CI tests ...

fip17 commented 2 years ago

Still seeing this problem in 2022-05. Multiple error messages on starting up Jupyter Lab: [W 2022-05-07 11:15:01.416 ServerApp] Config option template_path not recognized by ExporterCollapsibleHeadings. Did you mean one of: extra_template_paths, template_name, template_paths? [W 2022-05-07 11:15:01.471 ServerApp] Config option template_path not recognized by TocExporter. Did you mean one of: extra_template_paths, template_name, template_paths? [W 2022-05-07 11:15:01.496 ServerApp] Config option template_path not recognized by LenvsHTMLExporter. Did you mean one of: extra_template_paths, template_name, template_paths?

stefansimik commented 2 years ago

Still seeing this problem in 2022-05. Multiple error messages on starting up Jupyter Lab: [W 2022-05-07 11:15:01.416 ServerApp] Config option template_path not recognized by ExporterCollapsibleHeadings. Did you mean one of: extra_template_paths, template_name, template_paths? [W 2022-05-07 11:15:01.471 ServerApp] Config option template_path not recognized by TocExporter. Did you mean one of: extra_template_paths, template_name, template_paths? [W 2022-05-07 11:15:01.496 ServerApp] Config option template_path not recognized by LenvsHTMLExporter. Did you mean one of: extra_template_paths, template_name, template_paths?

Yeah, that's true. This basic thing in Jupyterlab is broken for 1 year.

K20shores commented 1 year ago

So what still needs to be done to fix this? With a clean install (done yesterday), removing all of the old config files, and replacing template_path with template_paths in the directories after they are made, I still see all of these warning messages. Is it because this package has not done a release since 2019?

stefansimik commented 1 year ago

So what still needs to be done to fix this? With a clean install (done yesterday), removing all of the old config files, and replacing template_path with template_paths in the directories after they are made, I still see all of these warning messages. Is it because this package has not done a release since 2019?

Exactly, with clean install, it still does not work. After a lot of frustration, with basic things not working, I decided to go with Quarto and do not rely on exports using jupyter-contrib-nbextensions + nbconvert

juhasch commented 1 year ago

The template_path problems should be fixed now in the jupyter-nbextensions-configurator. There is a PyPi release for this. We are still trying to get a new conda package out, too.

xiechenhao commented 1 year ago

The template_path problems should be fixed now in the jupyter-nbextensions-configurator. There is a PyPi release for this. We are still trying to get a new conda package out, too.

I have installed the latest version,but still can not fix the problem.

juhasch commented 1 year ago

The issue should be fixed from our side. Please check if you still have jupyter-latex-envs installed or provide more information.

demotu commented 1 year ago

I can confirm it works with the latest version (jupyter-contrib-nbextensions 0.7.0 via pip). I did the following as suggested: conda uninstall jupyter_latex_envs
pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master
jupyter contrib nbextension install --sys-prefix
No more messages related to template_path and both html and pdf (via LaTeX) outputs work.

Thanks.

stefansimik commented 1 year ago

Does also export as html_toc work for you?

I tested, and it worked - i.e. output HTML file was generated without any errors in console, but the final content of the file was partially wrong - because the main point - the TOC was completely missing and at its place text None was displayed in HTML file. But maybe, this does not relate closely with this issue 👍

demotu commented 1 year ago

Yes, it shows the TOC correctly when using the menu option Download as for both HTML + TOC and PDF via LaTeX.
However, in the html file it also shows None at the top (in the pdf file it doesn't).

stefansimik commented 1 year ago

Thanks for confirmation. I would like to report issue, that html_toc type of export does not work correctly. Where could I report it please? (I have no idea, which specific library is responsible for this specific issue)

juhasch commented 1 year ago

This is the right repo to report this issue. Unfortunately, the original author is no longer active, so fixing things takes time.

The Jupyter configuration system is not so easy to understand, but basically the html_toc option uses the toc2.tpl template to export a html with toc. This template is outdated and links to resources that are no longer online.

An attempted fix can be found in PR #1622.