Open ivarzap opened 3 years ago
@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: https://github.com/jupyter/nbconvert/issues/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:
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.
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:
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.template_path
, extra_template_path
, and extra_template_basedir
as the following: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.
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 package[^1] seems to be the culprit, as noted by several commenters above.
[^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
.
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 byLenvsHTMLExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.293 NotebookApp] Config optiontemplate_path
not recognized byLenvsHTMLExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.314 NotebookApp] Config optiontemplate_path
not recognized byLenvsTocHTMLExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.324 NotebookApp] Config optiontemplate_path
not recognized byLenvsTocHTMLExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.366 NotebookApp] Config optiontemplate_path
not recognized byLenvsLatexExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.371 NotebookApp] Config optiontemplate_path
not recognized byLenvsLatexExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.555 NotebookApp] Config optiontemplate_path
not recognized byLenvsSlidesExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.562 NotebookApp] Config optiontemplate_path
not recognized byLenvsSlidesExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.663 NotebookApp] Config optiontemplate_path
not recognized byLenvsHTMLExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.673 NotebookApp] Config optiontemplate_path
not recognized byLenvsHTMLExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.694 NotebookApp] Config optiontemplate_path
not recognized byLenvsTocHTMLExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.704 NotebookApp] Config optiontemplate_path
not recognized byLenvsTocHTMLExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.746 NotebookApp] Config optiontemplate_path
not recognized byLenvsLatexExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.752 NotebookApp] Config optiontemplate_path
not recognized byLenvsLatexExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.911 NotebookApp] Config optiontemplate_path
not recognized byLenvsSlidesExporter
. Did you mean one of:template_file, template_name, template_paths
? [W 18:49:22.917 NotebookApp] Config optiontemplate_path
not recognized byLenvsSlidesExporter
. Did you mean one of:template_file, template_name, template_paths
?