Zurück zum Blog

Convert IPYNB to PDF on Linux: Ubuntu, Debian, and Fedora Guide

The Linux-native guide to converting Jupyter Notebooks to PDF. Install texlive-xetex on Ubuntu/Debian, set up nbconvert on Fedora, or skip LaTeX entirely with webpdf.

  • #linux
  • #guide
  • #nbconvert

Linux is, paradoxically, both the easiest and the most fragmented platform for converting Jupyter Notebooks to PDF. The tooling is all there, but the package names differ across distros and the default configurations rarely work without tweaking. Here's a distro-by-distro guide for 2026.

The Universal Option — Online Converter

Before we get into distro specifics: if you just need a PDF and don't want to install anything, use ipynbtopdf.org. It works in any Linux browser — Firefox, Chrome, Chromium, even Epiphany — and produces a clean PDF in ~3 seconds. No sudo required.

Ubuntu / Debian (apt)

Option A — Classic nbconvert with TeX Live

sudo apt update
sudo apt install -y python3-notebook texlive-xetex texlive-fonts-recommended texlive-plain-generic texlive-latex-extra
jupyter nbconvert --to pdf notebook.ipynb

Why these specific packages:

  • texlive-xetex provides xelatex (the Unicode-aware LaTeX engine).
  • texlive-fonts-recommended covers the default fonts nbconvert expects.
  • texlive-latex-extra pulls in packages like enumitem and titlesec that nbconvert templates depend on.

Without texlive-latex-extra, you'll hit ! LaTeX Error: File 'titlesec.sty' not found on the first conversion.

Option B — LaTeX-free webpdf

sudo apt install -y python3-pip
pip install "nbconvert[webpdf]" --user
playwright install chromium
jupyter nbconvert --to webpdf notebook.ipynb

On Ubuntu 22.04+, playwright install chromium pulls system dependencies automatically. On older Ubuntu 20.04, you may need:

sudo apt install -y libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \
  libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 \
  libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2

Fedora (dnf)

sudo dnf install -y python3-jupyter_client python3-nbconvert \
  texlive-xetex texlive-collection-fontsrecommended texlive-collection-latexrecommended
jupyter nbconvert --to pdf notebook.ipynb

Fedora's TeX Live packaging splits things differently than Debian. The texlive-collection-* meta-packages pull in what you need.

For the webpdf path:

pip install "nbconvert[webpdf]" --user
playwright install chromium
jupyter nbconvert --to webpdf notebook.ipynb

Fedora 38+ ships Chromium dependencies in the base repo, so playwright install "just works."

Arch Linux (pacman)

Arch users, you're in luck — everything is in the official repos:

sudo pacman -S jupyterlab python-nbconvert texlive-bin texlive-latexextra texlive-fontsrecommended
jupyter nbconvert --to pdf notebook.ipynb

For webpdf:

sudo pacman -S python-playwright
playwright install chromium
jupyter nbconvert --to webpdf notebook.ipynb

Alpine Linux (apk)

Alpine is the trickiest because of its musl libc. The official TeX Live packages are incomplete, so:

  • For nbconvert + LaTeX: Alpine isn't recommended. Use a Debian container instead.
  • For webpdf: Works, but you need to install Chromium's musl-compatible build and its dependencies manually. See the playwright Alpine docs.
  • For online conversion: Works perfectly — Alpine's Firefox and Chromium builds have no issues with browser-based converters.

Common Linux Gotchas

xelatex: command not found after install

This means the TeX Live bin directory isn't on your PATH. On Debian/Ubuntu:

export PATH="/usr/local/texlive/2024/bin/x86_64-linux:$PATH"

Add to ~/.bashrc or ~/.zshrc to make it permanent.

Fontconfig warning spam

Harmless, but noisy. Suppress by ensuring fontconfig cache is built:

fc-cache -fv

Snap'd Python can't see system TeX

If you installed Jupyter via Snap, it runs in a sandbox that can't access /usr/bin/xelatex. Either install Jupyter via pip/apt instead, or use the webpdf path which doesn't need system TeX.

Permission errors on first conversion

If you're the first user on a fresh server to run nbconvert, TeX Live tries to write cache files to /usr/local/share/texmf/. Fix with:

sudo chown -R $USER:$USER ~/.texlive

Headless Servers / Containers

For CI/CD or Docker:

  • Smallest image: Use python:3.12-slim + nbconvert[webpdf] + playwright install chromium --with-deps. ~600 MB total.
  • Classic nbconvert image: python:3.12 + TeX Live full. ~2 GB.

The webpdf path is almost always the better choice for headless environments.

Which Method Should You Use?

Distro / SituationBest method
Any Linux, just need a PDFipynbtopdf.org
Ubuntu/Debian desktopnbconvert --to pdf + texlive
Fedora workstationnbconvert --to pdf + texlive
Archnbconvert --to pdf + texlive
Headless server / CInbconvert --to webpdf
AlpineOnline converter

Conclusion

Linux users have the most flexibility when it comes to IPYNB to PDF conversion — every option works, it's just a matter of picking the right one for your distro. For desktop use, the classic nbconvert --to pdf with a proper TeX Live install remains excellent. For servers, containers, or locked-down environments, webpdf or the online converter are dramatically simpler.

Convert IPYNB to PDF on Linux: Ubuntu, Debian, and Fedora Guide | IPYNB-zu-PDF-Konverter