Bug summary
Hi, I found that the function find_tex_file in dviread.py can not fallback to using kpsewhich when luatex does not work. I think the problem is caused by the fact that my glibc is too old, i.e., when I run luatex --luaonly, I get:
luatex: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by luatex)
LaTeX version: pdfTeX 3.141592653-2.6-1.40.29 (TeX Live 2026)
Code for reproduction
## matplotlib
import matplotlib
matplotlib.use('Agg')
matplotlib.rcParams['text.latex.preamble'] = r'\usepackage{amsmath}';
matplotlib.rc('text', usetex = True)
from matplotlib import pyplot as py
xs = [1.0, 2.0, 3.0]
ys = [1.0, 2.0, 3.0]
axs = [py.subplot(1, 1, 1)]
axs[0].plot(xs, ys, color = 'dodgerblue')
x_label = r'$\Delta, \Theta, \Xi, \Pi, \Sigma, \Upsilon, \Phi, \Psi, \Omega, \Gamma$'
y_label = r'$\delta, \theta, \xi, \pi, \sigma, \upsilon, \phi, \psi, \omega, \gamma$'
axs[0].set_xlabel(x_label, size = 20)
axs[0].set_ylabel(y_label, size = 20)
py.tight_layout()
name = './test.pdf'
py.savefig(name)
py.close()
Actual outcome
Traceback (most recent call last):
File "/public/home/zhouyy/test/test.py", line 16, in <module>
py.tight_layout()
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/pyplot.py", line 2992, in tight_layout
gcf().tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/figure.py", line 3665, in tight_layout
engine.execute(self)
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/layout_engine.py", line 188, in execute
kwargs = get_tight_layout_figure(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/_tight_layout.py", line 266, in get_tight_layout_figure
kwargs = _auto_adjust_subplotpars(fig, renderer,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/_tight_layout.py", line 82, in _auto_adjust_subplotpars
bb += [martist._get_tightbbox_for_layout_only(ax, renderer)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/artist.py", line 1485, in _get_tightbbox_for_layout_only
return obj.get_tightbbox(*args, **{**kwargs, "for_layout_only": True})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/axes/_base.py", line 4740, in get_tightbbox
ba = martist._get_tightbbox_for_layout_only(axis, renderer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/artist.py", line 1485, in _get_tightbbox_for_layout_only
return obj.get_tightbbox(*args, **{**kwargs, "for_layout_only": True})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/axis.py", line 1427, in get_tightbbox
self._update_label_position(renderer)
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/axis.py", line 2615, in _update_label_position
bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/axis.py", line 2403, in _get_tick_boxes_siblings
tlb, tlb2 = axis._get_ticklabel_bboxes(ticks_to_draw, renderer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/axis.py", line 1404, in _get_ticklabel_bboxes
return ([tick.label1.get_window_extent(renderer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/text.py", line 1076, in get_window_extent
bbox, _, _ = self._get_layout(self._renderer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/text.py", line 465, in _get_layout
_, h, min_descent = _get_text_metrics_with_cache(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/text.py", line 59, in _get_text_metrics_with_cache
return get_text_metrics(text, fontprop.copy(), ismath, dpi)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/text.py", line 125, in _text_metrics
return local_renderer.get_text_width_height_descent(text, fontprop, ismath)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/backends/backend_agg.py", line 256, in get_text_width_height_descent
return super().get_text_width_height_descent(s, prop, ismath)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/backend_bases.py", line 589, in get_text_width_height_descent
return self.get_texmanager().get_text_width_height_descent(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/texmanager.py", line 372, in get_text_width_height_descent
page, = dvi
^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/dviread.py", line 278, in __iter__
while self._read():
^^^^^^^^^^^^
File "/public/home/zhouyy/packages/miniforge3/lib/python3.12/site-packages/matplotlib/dviread.py", line 360, in _read
raise self._missing_font.to_exception()
FileNotFoundError: Matplotlib's TeX implementation searched for a file named 'cmss10.tfm' in your texmf tree, but could not find it
Expected outcome
The expected outcome can be achieved by commenting out the following lines and manually set lk to None in function find_tex_file in dviread.py:
# try:
# lk = _LuatexKpsewhich()
# except (FileNotFoundError, OSError):
# lk = None # Fallback to directly calling kpsewhich, as below.
lk = None
But this has caused a further issue: \Gamma (and only \Gamma, see the x-axis label) can not be rendered properly.
test.pdf
Additional information
No response
Operating system
Linux 3.10.0-1160.el7.x86_64
Matplotlib Version
3.11.0
Matplotlib Backend
Agg
Python version
3.12.12
Jupyter version
No response
Installation
pip
Bug summary
Hi, I found that the function
find_tex_fileindviread.pycan not fallback to usingkpsewhichwhenluatexdoes not work. I think the problem is caused by the fact that myglibcis too old, i.e., when I runluatex --luaonly, I get:luatex: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by luatex)LaTeX version: pdfTeX 3.141592653-2.6-1.40.29 (TeX Live 2026)
Code for reproduction
Actual outcome
Expected outcome
The expected outcome can be achieved by commenting out the following lines and manually set
lktoNonein functionfind_tex_fileindviread.py:But this has caused a further issue:
\Gamma(and only\Gamma, see the x-axis label) can not be rendered properly.test.pdf
Additional information
No response
Operating system
Linux 3.10.0-1160.el7.x86_64
Matplotlib Version
3.11.0
Matplotlib Backend
Agg
Python version
3.12.12
Jupyter version
No response
Installation
pip