Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug summary
When I executepython -c 'import matplotlib.pyplot'
, python will coredump. This will occur when it is generating the~/.cache/matplotlib/fontlist-v330.json
file, assuming that it was not already successfully generated.
The root cause of the problem is that the/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf
font will cause aninvalid pixel size
exception to be thrown from the FreeType library, the exception is not subsequently handled in the C++ layer, and python will abort.
Code for reproduction
[-f/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf ] \&&/bin/rm-f~/.cache/matplotlib/fontlist-v330.json \&&python-c"import matplotlib.pyplot"
Actual outcome
[1] 229645 abort (core dumped) python -c
Expected outcome
No output
Additional information
It appears that this is only caused by the NotoColorEmoji font. If I update font_manager.py to skip this font, there is no issue.
This was at least working in 3.1.3. I have tried 3.4.3 and 3.6.1 and they both have the same issue. I'm using system_freetype=True in the mplsetup.py file. I have also tried compiling FreeType and this does not seem to resolve anything.
The root cause of the problem is that the/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf
font will cause aninvalid pixel size
exception to be thrown from the FreeType library, the exception is not subsequently handled in the C++ layer, and python will abort.
I am using RedHat 7.6, 7.3 works fine because it does not have the problematic font.
Here is a link to a similar issue using Pillow,issue. I'm not familiar with the code, but my understanding is that the correct solution would be the handle the FreeType exceptions in the ft2font_wrapper.cpp code and not propogate it into the Python interpreter.
Here is part of the stack trace.
#0 0x00007f7862cef207 in raise () from /lib64/libc.so.6
#1 0x00007f7862cf08f8 in abort () from /lib64/libc.so.6
#2 0x00007f784cfb2420 in _Unwind_SetGR (context=, index=, val=)
at /tmp/gcc-v9.3.0p3/gcc.source/libgcc/unwind-dw2.c:1442
#3 0x00007f784cfbe797 in __gcc_personality_v0 (version=, actions=, exception_class=, ue_header=0x15d9bf0,
context=0x7fff105961e0) at /tmp/gcc-v9.3.0p3/gcc.source/libgcc/unwind-c.c:231
#4 0x00007f785a69a7b3 in _Unwind_RaiseException_Phase2 () at /tmp/gcc-v9.3.0p4lnx86/gcc.source/libgcc/unwind.inc:64
#5 0x00007f785a69acf1 in _Unwind_RaiseException (exc=0x15d9bf0) at /tmp/gcc-v9.3.0p4lnx86/gcc.source/libgcc/unwind.inc:136
#6 0x00007f785a74a358 in __cxa_throw () from .../lib/64bit/libstdc++.so.6
#7 0x00007f784cfb12a1 inthrow_ft_error(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int) [clone .cold] ()
from .../lib/python3.9/site-packages/matplotlib-3.6.1-py3.9-linux-x86_64.egg/matplotlib/ft2font.cpython-39-x86_64-linux-gnu.so
#8 0x00007f784cfb9868 inPyFT2Font_init(PyFT2Font*, _object*, _object*) () at /tmp/gcc-v9.3.0p3/gcc.source/libgcc/unwind-dw2.c:1442
Operating system
RedHat 7.6
Matplotlib Version
3.6.1
Matplotlib Backend
Call to getBackend also crashes (same reason as above)
Python version
3.9.16
Jupyter version
No response
Installation
None