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
{{ message }}
Repository navigation
matplotlib 3.11 prints "findfont: Failed to find font weight normal" on 17 lectures #110
Since the anaconda 2026.07 bump (#102), matplotlib 3.11 prints this line in the output of 17 lectures, 77 times in all:
findfont: Failed to find font weight normal, now using 600.
The line goes to stderr. This repo shows stderr output (nb_merge_streams: true), so readers see it on the rendered pages. It does not fail the build, so CI stays green.
Where
These numbers come from the cache.yml run on a561ca1, the first full execution under anaconda 2026.07 (matplotlib 3.11.0). Its executed notebooks were compared with the previous run under 2025.12 (matplotlib 3.10.6), which had none of these lines.
need_for_speed also registers the font but printed nothing in this run.
Cause
The repo ships one weight of the Chinese font, lectures/_fonts/SourceHanSerifSC-SemiBold.otf, weight 600. The # i18n cells register it and make it the default family:
mpl.font_manager.fontManager.addfont(FONTPATH) # i18nmpl.rcParams['font.family'] = ['Source Han Serif SC'] # i18n
Normal text asks for weight 400 and bold text for 700. Both matplotlib versions fall back to the only weight there is, 600. Version 3.10 did so silently; 3.11 logs a warning through the matplotlib.font_manager logger each time.
The fallback itself is unchanged. With the same font cell and a figure containing Chinese labels:
Output
Figure
matplotlib 3.10.6
nothing printed
matplotlib 3.11.0
findfont: Failed to find font weight normal, now using 600. and the same line for bold
byte-identical PNG to 3.11 with the warning silenced
Proposed fix
Add two # i18n lines next to the existing font registration, in the 18 lectures that call fontManager.addfont:
This silences only the font manager's lookup messages, which restores the 3.10 behaviour. A missing glyph is still reported, because matplotlib raises that through Python's warnings module, not this logger. Tested under 3.11.0: no output, and an identical figure.
Alternatives considered:
mpl.rcParams['font.weight'] = 'semibold': does not help. Legends and labels still ask for normal and bold text for bold, so the warnings remain. It also adds a new warning where DejaVu Sans is the fallback family, because DejaVu has no semibold weight.
Shipping a Regular (and Bold) weight: fixes the cause, but each weight is about 24 MB, and the figures look the same either way.
The current fix is in #111. It adds the two # i18n lines proposed above to the 18 lectures that register the font, so matplotlib's font manager logs only errors:
This hides the findfont lines without changing any figure. It treats the symptom, though: we still ship only the SemiBold weight, and matplotlib still falls back to it for normal and bold text.
#111 references this issue without a closing keyword, so this stays open while other matplotlib approaches are considered. Options include shipping a proper Regular and Bold weight, or configuring the font another way. If one of those is adopted, the two lines can come back out.
Activity
mmcky commentedon Oct 13, 2026
The current fix is in #111. It adds the two
# i18nlines proposed above to the 18 lectures that register the font, so matplotlib's font manager logs only errors:This hides the
findfontlines without changing any figure. It treats the symptom, though: we still ship only the SemiBold weight, and matplotlib still falls back to it for normal and bold text.#111 references this issue without a closing keyword, so this stays open while other matplotlib approaches are considered. Options include shipping a proper Regular and Bold weight, or configuring the font another way. If one of those is adopted, the two lines can come back out.
Generated by Claude Code
Silence matplotlib 3.11's font-weight fallback warning in the i18n fo…