This seems to be most evident when using the CLI:
pi@pi-top:~ $ pi-top devices hub
Matplotlib is building the font cache; this may take a moment.
Interestingly, this does not appear to be related to our explicit use of matplotlib.
from matplotlib.font_manager import FontManager
f = FontManager()
The creation of this object is what triggers this message - however, it is on a 5s timer.
pi@pi-top:~ $ time !!
time python3 -c "from matplotlib.font_manager import FontManager; f = FontManager()"
real 0m4.416s
user 0m4.273s
sys 0m0.827s
Given that the time that this takes is ~4.5s on a Pi 4 anyway, it seems that this is something that will continue to occur. There is no API for controlling the behaviour of this class.
Source:
# Delay the warning by 5s.
timer = Timer(5, lambda: _log.warning(
'Matplotlib is building the font cache; this may take a moment.'))
timer.start()
try:
for fontext in ["afm", "ttf"]:
for path in [*findSystemFonts(paths, fontext=fontext),
*findSystemFonts(fontext=fontext)]:
try:
self.addfont(path)
except OSError as exc:
_log.info("Failed to open font file %s: %s", path, exc)
except Exception as exc:
_log.info("Failed to extract font properties from %s: "
"%s", path, exc)
finally:
timer.cancel()
This seems to be most evident when using the CLI:
Interestingly, this does not appear to be related to our explicit use of matplotlib.
The creation of this object is what triggers this message - however, it is on a 5s timer.
Given that the time that this takes is ~4.5s on a Pi 4 anyway, it seems that this is something that will continue to occur. There is no API for controlling the behaviour of this class.
Source: