Export for HTML and PDF fails
See original GitHub issueEnvironment data
- VS Code version: 1.66.2 (Universal)
- Jupyter Extension version (available under the Extensions sidebar): v2022.3.1000901801
- Python Extension version (available under the Extensions sidebar): v2022.4.1
- OS (Windows | Mac | Linux distro) and version: macOS Monterey 12.3.1
- Python and/or Anaconda version: 3.9.12
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): -
- Jupyter server running: Local
- LaTeX version: MacTex Version 3.141592653 (TeX Live 2021)
- nbconvert: 6.5.0
- jupyter: 1.0.0
- jupyter-core: 4.10.0
Expected behaviour
I want to export a pdf of my jupyter notebook (.ipynb) file, using the VSCode Jupyter Extension Export
-> PDF
.
Actual behaviour
The PDF as well as the HTML does not work.
Steps to reproduce:
- Open a Jupyter notebook in VSCode with the given prerequisites.
- Try to export the notebook to pdf.
Logs
Output for Jupyter Export to PDF
using nbconvert
: (in details)
Info 13:30:28: Process Execution: > /opt/homebrew/bin/python3 -m jupyter nbconvert /var/folders/1y/j228qgqn77jbvrqsk9b05b9c0000gn/T/3563a4c8-8fb9-41a5-ad7d-970042783579/SymbolicTranspNet.ipynb --to pdf --output tmp-1155Mn8FYXPkXL2t.pdf --output-dir /var/folders/1y/j228qgqn77jbvrqsk9b05b9c0000gn/T --debug
> /opt/homebrew/bin/python3 -m jupyter nbconvert /var/folders/1y/j228qgqn77jbvrqsk9b05b9c0000gn/T/3563a4c8-8fb9-41a5-ad7d-970042783579/SymbolicTranspNet.ipynb --to pdf --output tmp-1155Mn8FYXPkXL2t.pdf --output-dir /var/folders/1y/j228qgqn77jbvrqsk9b05b9c0000gn/T --debug
Error 13:30:28: Export failed [Error: [NbConvertApp] Searching ['/', '/Users/dguger/.jupyter', '/Users/dguger/Library/Python/3.9/etc/jupyter', '/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[NbConvertApp] Looking for jupyter_config in /etc/jupyter
[NbConvertApp] Looking for jupyter_config in /usr/local/etc/jupyter
[NbConvertApp] Looking for jupyter_config in /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/etc/jupyter
[NbConvertApp] Looking for jupyter_config in /Users/dguger/Library/Python/3.9/etc/jupyter
[NbConvertApp] Looking for jupyter_config in /Users/dguger/.jupyter
[NbConvertApp] Looking for jupyter_config in /
[NbConvertApp] Looking for jupyter_nbconvert_config in /etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /usr/local/etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /Users/dguger/Library/Python/3.9/etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /Users/dguger/.jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 537, in get
value = obj._trait_values[self.name]
KeyError: 'template_paths'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/bin/jupyter-nbconvert", line 8, in <module>
sys.exit(main())
File "/opt/homebrew/lib/python3.9/site-packages/jupyter_core/application.py", line 269, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/config/application.py", line 846, in launch_instance
app.start()
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 414, in start
self.convert_notebooks()
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 582, in convert_notebooks
cls = get_exporter(self.export_format)
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 101, in get_exporter
if getattr(exporter(config=config), "enabled", True):
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 341, in __init__
super().__init__(config=config, **kw)
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 117, in __init__
self._init_preprocessors()
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 507, in _init_preprocessors
conf = self._get_conf()
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 525, in _get_conf
for path in map(Path, self.template_paths):
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 577, in __get__
return self.get(obj, cls)
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 540, in get
default = obj.trait_defaults(self.name)
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 1580, in trait_defaults
return self._get_trait_default_generator(names[0])(self)
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 977, in __call__
return self.func(*args, **kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 536, in _template_paths
template_names = self.get_template_names()
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 620, in get_template_names
raise ValueError(
ValueError: No template sub-directory with name 'latex' found in the following paths:
/Users/dguger/Library/Jupyter
/Users/dguger/Library/Python/3.9/share/jupyter
/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/share/jupyter
/usr/local/share/jupyter
/usr/share/jupyter
at a.executeCommand (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:979748)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async a.export (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:986562)
at async _.exportToFormat (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:994081)
at async _.performNbConvertExport (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:993365)
at async _.performExport (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:993001)
at async _.exportImpl (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:992450)
at async _.export (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:992183)
at async b.export (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:95367)
at async m._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:30752)]
Error 13:30:28: If you have not installed xelatex (TeX) you will need to do so before you can export to PDF, for further instructions go to https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex.
To avoid installing xelatex (TeX) you might want to try exporting to HTML and using your browsers "Print to PDF" feature.
Output for Jupyter Export to HTML
: (in details)
Info 13:29:29: Process Execution: > /opt/homebrew/bin/python3 -m jupyter nbconvert /var/folders/1y/j228qgqn77jbvrqsk9b05b9c0000gn/T/32053d2e-c8cc-4e57-abb2-79f9ea78cbdb/SymbolicTranspNet.ipynb --to html --output tmp-1155zNk12NwjKJlI.html --output-dir /var/folders/1y/j228qgqn77jbvrqsk9b05b9c0000gn/T --debug
> /opt/homebrew/bin/python3 -m jupyter nbconvert /var/folders/1y/j228qgqn77jbvrqsk9b05b9c0000gn/T/32053d2e-c8cc-4e57-abb2-79f9ea78cbdb/SymbolicTranspNet.ipynb --to html --output tmp-1155zNk12NwjKJlI.html --output-dir /var/folders/1y/j228qgqn77jbvrqsk9b05b9c0000gn/T --debug
Error 13:29:30: Export failed [Error: [NbConvertApp] Searching ['/', '/Users/dguger/.jupyter', '/Users/dguger/Library/Python/3.9/etc/jupyter', '/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[NbConvertApp] Looking for jupyter_config in /etc/jupyter
[NbConvertApp] Looking for jupyter_config in /usr/local/etc/jupyter
[NbConvertApp] Looking for jupyter_config in /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/etc/jupyter
[NbConvertApp] Looking for jupyter_config in /Users/dguger/Library/Python/3.9/etc/jupyter
[NbConvertApp] Looking for jupyter_config in /Users/dguger/.jupyter
[NbConvertApp] Looking for jupyter_config in /
[NbConvertApp] Looking for jupyter_nbconvert_config in /etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /usr/local/etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /Users/dguger/Library/Python/3.9/etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /Users/dguger/.jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 537, in get
value = obj._trait_values[self.name]
KeyError: 'template_paths'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/bin/jupyter-nbconvert", line 8, in <module>
sys.exit(main())
File "/opt/homebrew/lib/python3.9/site-packages/jupyter_core/application.py", line 269, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/config/application.py", line 846, in launch_instance
app.start()
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 414, in start
self.convert_notebooks()
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 582, in convert_notebooks
cls = get_exporter(self.export_format)
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 101, in get_exporter
if getattr(exporter(config=config), "enabled", True):
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 341, in __init__
super().__init__(config=config, **kw)
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 117, in __init__
self._init_preprocessors()
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 507, in _init_preprocessors
conf = self._get_conf()
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 525, in _get_conf
for path in map(Path, self.template_paths):
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 577, in __get__
return self.get(obj, cls)
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 540, in get
default = obj.trait_defaults(self.name)
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 1580, in trait_defaults
return self._get_trait_default_generator(names[0])(self)
File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 977, in __call__
return self.func(*args, **kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 536, in _template_paths
template_names = self.get_template_names()
File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 620, in get_template_names
raise ValueError(
ValueError: No template sub-directory with name 'lab' found in the following paths:
/Users/dguger/Library/Jupyter
/Users/dguger/Library/Python/3.9/share/jupyter
/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/share/jupyter
/usr/local/share/jupyter
/usr/share/jupyter
at a.executeCommand (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:979748)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async a.export (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:985907)
at async _.exportToFormat (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:994151)
at async _.performNbConvertExport (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:993365)
at async _.performExport (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:993001)
at async _.exportImpl (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:992450)
at async _.export (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:992183)
at async b.export (/Users/dguger/.vscode/extensions/ms-toolsai.jupyter-2022.3.1000901801/out/extension.js:2:95367)
at async m._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:30752)]
Issue Analytics
- State:
- Created a year ago
- Comments:15 (5 by maintainers)
Top Results From Across the Web
Failed PDF Conversion: 5 Common Errors and Fixes - Inkit
#1. Conversion to PDF failed because of mistakes in HTML code · #2. HTML document formatting issues · #3. Rendering software integration mistakes....
Read more >"Failed to export PDF" message in InDesign - Adobe Support
Solution 1: Use Acrobat to downsample the images after you export. ... Choose File > Export and select PDF as your format, choose...
Read more >Space export to PDF fails during conversion of intermediate ...
When exporting a space to PDF the export progress stops and fails during {{Begin conversion of intermediate HTML to PDF}} of the export...
Read more >Convert HTML to PDF fails on last step
I've set up a Flow for creating an HTML file in OneDrive and converting it to a PDF, based on a video by...
Read more >Error when exporting long pages to PDF - SolarWinds THWACK
2017-02-14 16:03:28,826 [10] (0) ERROR Orion_ExportToPDF - (null) Unable to convert html into PDF file. EO.Pdf.HtmlToPdfException: Conversion failed. Browser ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@guger If the nbconvert command doesn’t work from the command line then it won’t be able to work from vs code either as we are calling the same command to do the convert. Might need to try re-installing jupyter or creating a new environment to see if that works. I’m closing this issue for now, but if the command is working from the command line, but not working from vs code, just ping back and I can reopen and investigate.
This is the stacktrace from your command: