FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[Bug]: IBM unix system services - Fonts can'be read in - no labelling is possible · Issue #32514 · matplotlib/matplotlib · GitHub

Repository navigation

[Bug]: IBM unix system services - Fonts can'be read in - no labelling is possible #32514

Open

Description

Bug summary

Fonts can'be read on IBM USS (unix) so no labeling possible a raw graph can be created and saved to file.

Python: 3.12.13 (heads/pyz_dev-3.12:fe57f277d86, May 24 2026, 08:17:10) [Clang 14.0.0 (build 588d20f)]
Matplotlib: 3.8.4
Matplotlib module: /usr/local/pip/matplotlib/init.py
FT2Font module: /usr/local/pip/matplotlib/ft2font.cpython-312.so
FreeType: 2.6.1
Matplotlib data: /usr/local/pip/matplotlib/mpl-data

font content look ok:
chtag -p "/usr/local/pip/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf"
file "/usr/local/pip/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf"
od -An -tx1 -N16 "/usr/local/pip/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf"

  • untagged T=off /usr/local/pip/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf
    file: magic file "/etc/magic": EDC5129I No such file or directory.
    00 01 00 00 00 14 01 00 00 04 00 40 46 46 54 4D

S@ZOS31 /u/s/tlh_analyse_try > ls -l "/usr/local/pip/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf"
-rwxr-xr-x 1 ROOT SUDOGRP 756072 Feb 9 2026 /usr/local/pip/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf

Code for reproduction

python3 - <<'PY'
import glob
from matplotlib.ft2font import FT2Font

font_dir = "/usr/local/pip/matplotlib/mpl-data/fonts/ttf"
for path in glob.glob(font_dir + "/*.ttf"):
    try:
        FT2Font(path)
        print("OK:   ", path)
    except Exception as exc:
        print("FAIL: ", path, exc)
PY


-------------------- smoke test for a plot
import os

import matplotlib

matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib import font_manager


output_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "matplotlib_uss_test.png")
font_path = font_manager.findfont("DejaVu Sans")

print(f"Matplotlib backend: {matplotlib.get_backend()}")
print(f"Selected font: {font_path}")
print(f"Font exists: {os.path.isfile(font_path)}")

plt.figure(figsize=(6, 4))
plt.plot([0, 1, 2, 3], [0, 1, 4, 9], marker="o")
plt.title("Matplotlib USS smoke test")
plt.xlabel("X")
plt.ylabel("Y")
plt.grid(True)
plt.savefig(output_path, dpi=100)
plt.close()

print(f"Plot saved: {output_path}")
print(f"File size: {os.path.getsize(output_path)} bytes")

Actual outcome

/usr/local/pip/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf In FT2Font: Can not load face (unknown file format; error code 0x2)

Matplotlib backend: agg
Selected font: /usr/local/pip/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf
Font exists: True
Traceback (most recent call last):
File "/u/sri/tlh_analyse_try/test_matplotlib_uss.py", line 23, in
File "/usr/local/pip/matplotlib/pyplot.py", line 1134, in savefig
res = fig.savefig(*args, **kwargs) # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/figure.py", line 3390, in savefig
self.canvas.print_figure(fname, **kwargs)
File "/usr/local/pip/matplotlib/backend_bases.py", line 2193, in print_figure
result = print_method(
^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/backend_bases.py", line 2043, in
print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(
^^^^^
File "/usr/local/pip/matplotlib/backends/backend_agg.py", line 497, in print_png
self._print_pil(filename_or_obj, "png", pil_kwargs, metadata)
File "/usr/local/pip/matplotlib/backends/backend_agg.py", line 445, in _print_pil
FigureCanvasAgg.draw(self)
File "/usr/local/pip/matplotlib/backends/backend_agg.py", line 388, in draw
self.figure.draw(self.renderer)
File "/usr/local/pip/matplotlib/artist.py", line 95, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/artist.py", line 72, in draw_wrapper
return draw(artist, renderer)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/figure.py", line 3154, in draw
mimage._draw_list_compositing_images(
File "/usr/local/pip/matplotlib/image.py", line 132, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/local/pip/matplotlib/artist.py", line 72, in draw_wrapper
return draw(artist, renderer)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/axes/_base.py", line 3034, in draw
self._update_title_position(renderer)
File "/usr/local/pip/matplotlib/axes/_base.py", line 2978, in _update_title_position
ax.yaxis.get_tightbbox(renderer) # update offsetText
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/axis.py", line 1336, in get_tightbbox
self._update_label_position(renderer)
File "/usr/local/pip/matplotlib/axis.py", line 2609, in _update_label_position
bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/axis.py", line 2161, in _get_tick_boxes_siblings
tlb, tlb2 = axis._get_ticklabel_bboxes(ticks_to_draw, renderer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/axis.py", line 1315, in _get_ticklabel_bboxes
return ([tick.label1.get_window_extent(renderer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/text.py", line 956, in get_window_extent
bbox, info, descent = self._get_layout(self._renderer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/text.py", line 373, in _get_layout
_, lp_h, lp_d = _get_text_metrics_with_cache(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/text.py", line 69, in _get_text_metrics_with_cache
return _get_text_metrics_with_cache_impl(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/text.py", line 77, in _get_text_metrics_with_cache_impl
return renderer_ref().get_text_width_height_descent(text, fontprop, ismath)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/backends/backend_agg.py", line 220, in get_text_width_height_descent
font = self._prepare_font(prop)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/backends/backend_agg.py", line 254, in _prepare_font
font = get_font(_fontManager._find_fonts_by_props(font_prop))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/pip/matplotlib/font_manager.py", line 1554, in get_font
return _get_font(
^^^^^^^^^^
File "/usr/local/pip/matplotlib/font_manager.py", line 1496, in _get_font
return ft2font.FT2Font(
^^^^^^^^^^^^^^^^
RuntimeError: In FT2Font: Can not load face (unknown file format; error code 0x2)

Expected outcome

should label the plot

Additional information

I created a smoke-test after it did not work in a larger environment that works in ubuntu, but not under USS (z/OS)

Operating system

IBM USS that is z/OS

Matplotlib Version

3.8.4

Matplotlib Backend

No response

Python version

3.12

Jupyter version

No response

Installation

pip

Activity

  1. timhoffm commented on Oct 21, 2026

    Member

    Can you reproduce this with matplotlib 3.11? There’s been substantial changes to font handling, and we won’t do any fix es to an ancient matplotlib verse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL