You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's the first time for me to use nbconvert and I'm afraid I‘ve missed something, but I've really got no idea about that...
I'm encountering an issue with nbconvert where it fails to locate built-in LaTeX templates such as base.tplx. Even though the templates are present in the expected directory (as following), nbconvert doesn't seem to recognize them.
I've followed the official documentation and tried several troubleshooting steps, including specifying the template path manually, but the problem persists.
Steps to Reproduce
Install nbconvert and other Jupyter components using pip.
Place a Jupyter notebook (notebook.ipynb) in a working directory. There's my working directory tree:
nbconvert should successfully locate and use the base.tplx template (and other necessary templates) to convert the notebook to LaTeX format.
Actual Behavior
The conversion process fails with the following error:
jinja2.exceptions.TemplateNotFound: base.tplx
Debug Output
Here is the --debug output from the nbconvert command:
$ jupyter nbconvert --to latex --template-file ./latex/template/simple.tplx --output-dir ./latex/ ./notebook.ipynb --debug
[NbConvertApp] Searching ['C:\\Users\\asus\\.jupyter', 'D:\\Python\\Python39\\Scripts\\etc\\jupyter', 'D:\\Python\\Python39\\etc\\jupyter', 'C:\\ProgramData\\jupyter'] for config files
[NbConvertApp] Looking for jupyter_config in C:\ProgramData\jupyter
[NbConvertApp] Looking for jupyter_config in D:\Python\Python39\etc\jupyter
[NbConvertApp] Looking for jupyter_config in D:\Python\Python39\Scripts\etc\jupyter
[NbConvertApp] Looking for jupyter_config in C:\Users\asus\.jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in C:\ProgramData\jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in D:\Python\Python39\etc\jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in D:\Python\Python39\Scripts\etc\jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in C:\Users\asus\.jupyter
[NbConvertApp] Loaded config file: C:\Users\asus\.jupyter\jupyter_nbconvert_config.json
[NbConvertApp] Converting notebook ./notebook.ipynb to latex
[NbConvertApp] Notebook name is 'notebook'
Traceback (most recent call last):
File "D:\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\Python\Python39\Scripts\jupyter-nbconvert.EXE\__main__.py", line 7, in <module>
File "D:\Python\Python39\Lib\site-packages\jupyter_core\application.py", line 285, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
File "D:\Python\Python39\Lib\site-packages\traitlets\config\application.py", line 1043, in launch_instance
app.start()
File "D:\Python\Python39\Lib\site-packages\nbconvert\nbconvertapp.py", line 420, in start
self.convert_notebooks()
File "D:\Python\Python39\Lib\site-packages\nbconvert\nbconvertapp.py", line 597, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "D:\Python\Python39\Lib\site-packages\nbconvert\nbconvertapp.py", line 563, in convert_single_notebook
output, resources = self.export_single_notebook(
File "D:\Python\Python39\Lib\site-packages\nbconvert\nbconvertapp.py", line 487, in export_single_notebook
output, resources = self.exporter.from_filename(
File "D:\Python\Python39\Lib\site-packages\nbconvert\exporters\templateexporter.py", line 386, in from_filename
return super().from_filename(filename, resources, **kw) # type:ignore[return-value]
File "D:\Python\Python39\Lib\site-packages\nbconvert\exporters\exporter.py", line 201, in from_filename
return self.from_file(f, resources=resources, **kw)
File "D:\Python\Python39\Lib\site-packages\nbconvert\exporters\templateexporter.py", line 392, in from_file
return super().from_file(file_stream, resources, **kw) # type:ignore[return-value]
File "D:\Python\Python39\Lib\site-packages\nbconvert\exporters\exporter.py", line 220, in from_file
return self.from_notebook_node(
File "D:\Python\Python39\Lib\site-packages\nbconvert\exporters\latex.py", line 92, in from_notebook_node
return super().from_notebook_node(nb, resources, **kw)
File "D:\Python\Python39\Lib\site-packages\nbconvert\exporters\templateexporter.py", line 424, in from_notebook_node
output = self.template.render(nb=nb_copy, resources=resources)
File "D:\Python\Python39\Lib\site-packages\jinja2\environment.py", line 1301, in render
self.environment.handle_exception()
File "D:\Python\Python39\Lib\site-packages\jinja2\environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "E:\dev\数据分析教程\01-如何分类西瓜\latex\template\simple.tplx", line 2, in top-level template code
((*- extends 'base.tplx' -*))
jinja2.exceptions.TemplateNotFound: base.tplx
Description
jinja2.exceptions.TemplateNotFound: style_jupyter.tex.j2
#1975, which is really alike what I've met but not really the same, so I'm here submitting a new one.I'm encountering an issue with
nbconvert
where it fails to locate built-in LaTeX templates such asbase.tplx
. Even though the templates are present in the expected directory (as following),nbconvert
doesn't seem to recognize them.I've followed the official documentation and tried several troubleshooting steps, including specifying the template path manually, but the problem persists.
Steps to Reproduce
Install
nbconvert
and other Jupyter components using pip.Place a Jupyter notebook (
notebook.ipynb
) in a working directory. There's my working directory tree:. ├── data │ └── melon_data.csv ├── generator.py ├── image │ └── center.png ├── latex │ ├── notebook.tex │ ├── notebook_files │ │ ├── notebook_4_1.png │ │ └── notebook_6_2.png │ └── template │ └── simple.tplx └── notebook.ipynb 6 directories, 13 files
.tplx
like the following one:((*- extends 'base.tplx' -*)) ((* block body *)) ((( super() ))) ((* endblock body *))
Expected Behavior
nbconvert
should successfully locate and use thebase.tplx
template (and other necessary templates) to convert the notebook to LaTeX format.Actual Behavior
The conversion process fails with the following error:
Debug Output
Here is the
--debug
output from thenbconvert
command:Environment
Additional Context
D:/Python/Python39/share/jupyter/nbconvert/templates/latex
.--template-path
option without success.simple.tplx
are located inE:/dev/数据分析教程/01-如何分类西瓜/latex/template/
.Any help in resolving this issue would be greatly appreciated.
The text was updated successfully, but these errors were encountered: