matplotlib/matplotlib · error · ValueError
tfm checksum mismatch: {n}
Error message
tfm checksum mismatch: {n} What it means
Error "tfm checksum mismatch: {n}" thrown in matplotlib/matplotlib.
Source
Thrown at lib/matplotlib/dviread.py:538
self.fonts[k] = DviFont.from_luatex(s, n)
return
fontname = fontname.decode("ascii")
try:
tfm = _tfmfile(fontname)
except FileNotFoundError as exc:
if fontname.startswith("[") and fontname.endswith(";") and c == 0:
exc.add_note(
"This dvi file was likely generated with a too-old "
"version of luaotfload; luaotfload 3.23 is required.")
# Explicitly allow defining missing fonts for Vf support; we only
# register an error when trying to load a glyph from a missing font
# and throw that error in Dvi._read. For Vf, _finalize_packet
# checks whether a missing glyph has been used, and in that case
# skips the glyph definition.
self.fonts[k] = cbook._ExceptionInfo.from_exception(exc)
return
if c != 0 and tfm.checksum != 0 and c != tfm.checksum:
raise ValueError(f'tfm checksum mismatch: {n}')
try:
vf = _vffile(fontname)
except FileNotFoundError:
vf = None
self.fonts[k] = DviFont(scale=s, metrics=tfm, texname=n, vf=vf)
@_dispatch(247, state=_dvistate.pre, args=('u1', 'u4', 'u4', 'u4', 'u1'))
def _pre(self, i, num, den, mag, k):
self.file.read(k) # comment in the dvi file
if i not in [2, 7]: # 2: pdftex, luatex; 7: xetex
raise ValueError(f"Unknown dvi format {i}")
if num != 25400000 or den != 7227 * 2**16:
raise ValueError("Nonstandard units in dvi file")
# meaning: TeX always uses those exact values, so it
# should be enough for us to support those
# (There are 72.27 pt to an inch so 7227 pt =
# 7227 * 2**16 sp to 100 in. The numerator is multiplied
# by 10^5 to get units of 10**-7 meters.)View on GitHub (pinned to b379c1b69e)
When it happens
Trigger: Thrown at lib/matplotlib/dviread.py:538 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of matplotlib/matplotlib@b379c1b69e (2026-08-21).
Data as JSON: /api/errors/31c599b99c3e9b56.
Report an issue: GitHub.