Fixing nbconvert PDF export errors

Almost every one of these comes down to the same thing: --to pdf is not a PDF writer, it is a LaTeX writer. It renders your notebook to a .tex file and then asks a TeX engine to typeset it. If that engine is missing or unhappy, the export dies — usually with a message that says nothing about LaTeX.

The errors, one by one

nbconvert failed: xelatex not found on PATH

Why: nbconvert's PDF exporter renders through LaTeX, and no LaTeX engine is installed. Jupyter does not ship one.

Fix: Install a TeX distribution — MiKTeX on Windows, MacTeX on macOS, TeX Live on Linux — then reopen your terminal so PATH picks it up. Or skip LaTeX entirely with the webpdf exporter below.

500 : Internal Server Error (when exporting from the Jupyter menu)

Why: The same missing-LaTeX problem, surfaced through the web UI, which swallows the real message. The actual error is in the terminal running the Jupyter server.

Fix: Look at that terminal for the real cause. It is almost always a missing xelatex or pandoc.

Pandoc wasn't found / pandoc: command not found

Why: nbconvert converts Markdown cells through Pandoc, which is a separate binary and is not installed by pip.

Fix: Install Pandoc from pandoc.org, or with conda: conda install -c conda-forge pandoc.

PDF creating failed, captured latex output: ... Undefined control sequence

Why: A Markdown or output cell contains a character LaTeX cannot typeset — often an emoji, a box-drawing character from a progress bar, or CJK text under the default font.

Fix: Find and remove the offending character, or export through webpdf, which has no such restriction.

Everything runs, but the PDF has garbled or missing CJK characters

Why: The default LaTeX template uses a font with no Chinese, Japanese or Korean glyphs.

Fix: Either pass a CJK-capable template to nbconvert, or use webpdf — the browser already has the fonts.

The fix that works for all of them

If you do not specifically need LaTeX typesetting, stop fighting it and render through a browser instead:

pip install "nbconvert[webpdf]"
jupyter nbconvert --to webpdf --allow-chromium-download notebook.ipynb

Same tool, same notebook, no TeX distribution. The first run downloads a headless Chromium, so it is slow once and fast after.

Or skip the toolchain entirely

If you only need the PDF and not a repeatable pipeline, the browser converter on the home page does the same job with nothing installed. It reads the notebook locally, renders Markdown, syntax highlighting, KaTeX math and image outputs, and hands it to your browser’s own PDF writer. Nothing is uploaded, which also makes it usable for work you are not allowed to send to a third-party server.

Still stuck on LaTeX

When you genuinely need the LaTeX output, export the intermediate file and read the real error:

jupyter nbconvert --to latex notebook.ipynb

Then run xelatex notebook.tex by hand. The TeX log names the line and the character that broke it, which nbconvert’s wrapper does not.