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

Cross-compiling matplotlib and dependencies for OpenWRT fails on import matplotlib.pyplot · Issue #9244 · matplotlib/matplotlib · GitHub

Repository navigation

Cross-compiling matplotlib and dependencies for OpenWRT fails on import matplotlib.pyplot #9244

Closed

Description

Bug report

Bug summary

When cross-compiling matplotlib and dependencies (numpy, six, pytz, etc) for OpenWRT in Ubuntu 16.04LTS, all code properly compiles. However, when testing matplotlib on the target, when importing matplotlib.pyplot I get the failure "terminate called after throwing an instance of 'char const*'". Specifically, after a font is imported in font_manager, the failure comes up when attempting to add a second font (regardless of the first font). I've attempted multiple versions of Python3 (3.6.2, 3.6.0, 3.5.4), as well as numerous combinations of dependent packages. Not that I am only compiling freetype as a library for the shared object "libfreetype.so.6*", as well as the ft2font header file, instead of the full freetype package.

Code for reproduction

import matplotlib
print(matplotlib.__version__)
import matplotlib.pyplot as plt
print("Success!")

Actual outcome

root@LEDE:~# python3 test.py --verbose-debug
$HOME=/root
matplotlib data path /usr/lib/python3.6/site-packages/matplotlib/mpl-data

*****************************************************************
You have the following UNSUPPORTED LaTeX preamble customizations:

Please do not ask for support with these customizations active.
*****************************************************************

loaded rc file /usr/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 2.0.2
verbose.level debug
interactive is False
platform is linux
loaded modules: <dict_keyiterator object at 0x17ebb00>
CACHEDIR=/root/.cache/matplotlib
font search path ['/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf', '/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/afm', '/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts']
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf
createFontDict: /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf
createFontDict: /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf
terminate called after throwing an instance of 'char const*'
Aborted

Expected outcome

root@LEDE:~# python3 test.py 
2.0.2
Success!

Matplotlib version

  • Operating System: OpenWRT / LEDE V17.01.02
  • Matplotlib Version: 2.0.2
  • Python Version: 3.6.2
  • Other Libraries:
    • numpy: 1.12.1
    • six: 1.10.0
    • dateutil: 2.6.1
    • pytz: 2017.2
    • cycler: 0.10.0
    • pyparsing: 2.2.0
    • libfreetype: 2.5.5
    • libpng: 1.2.57
BUILDING MATPLOTLIB
            matplotlib: yes [2.0.2]
                python: yes [3.6.2 (default, Jun  8 2017, 21:02:37)  [GCC
                        5.4.0 20160609]]
              platform: yes [linux]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.12.1]
                   six: yes [using six version 1.10.0]
              dateutil: yes [using dateutil version 2.6.1]
           functools32: yes [Not required]
          subprocess32: yes [Not required]
                  pytz: yes [using pytz version 2017.2]
                cycler: yes [using cycler version 0.10.0]
               tornado: yes [tornado was not found. It is required for the
                        WebAgg backend. pip/easy_install may attempt to
                        install it after matplotlib.]
             pyparsing: yes [using pyparsing version 2.2.0]
                libagg: yes [pkg-config information for 'libagg' could not
                        be found. Using local copy.]
              freetype: yes [version 2.5.5]
                   png: yes [version 1.2.57]
                 qhull: yes [pkg-config information for 'qhull' could not be
                        found. Using local copy.]

Activity

  1. jwbrack commented on Sep 27, 2017

    Author

    Additionally, libfreetype was compile with the following options:

    CONFIGURE_ARGS += \
            --enable-shared \
            --enable-static \
            --with-bzip2=yes \
            --with-zlib=yes \
            --with-png=no \
    
  2. tacaswell commented on Sep 27, 2017

    Member

    Can you try against either master or v2.1.x branches? I have a vague memory of a similar issue being fixed.

  3. tacaswell commented on Sep 27, 2017

    Member

    you need to apply this patch locally I think #9074

  4. jwbrack commented on Sep 27, 2017

    Author

    Same results.

    Patch 9074 + V2.0.2

    root@LEDE:~# python3 test.py --verbose-debug
    $HOME=/root
    matplotlib data path /usr/lib/python3.6/site-packages/matplotlib/mpl-data
    
    *****************************************************************
    You have the following UNSUPPORTED LaTeX preamble customizations:
    
    Please do not ask for support with these customizations active.
    *****************************************************************
    
    loaded rc file /usr/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc
    matplotlib version 2.0.2
    verbose.level debug
    interactive is False
    platform is linux
    loaded modules: <dict_keyiterator object at 0x1e328c0>
    2.0.2
    CACHEDIR=/root/.cache/matplotlib
    font search path ['/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf', '/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/afm', '/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts']
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf
    createFontDict: /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf
    createFontDict: /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf
    terminate called after throwing an instance of 'char const*'
    Aborted
    

    Patch 9074 + V2.1.x @ f2c8fae

    root@LEDE:~# python3 test.py --verbose-debug
    $HOME=/root
    matplotlib data path /usr/lib/python3.6/site-packages/matplotlib/mpl-data
    loaded rc file /usr/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc
    matplotlib version 2.1.x
    verbose.level debug
    interactive is False
    platform is linux
    loaded modules: ['builtins', 'sys', '_frozen_importlib', '_imp', '_warnings', '_thread', '_weakref', '_frozen_importlib_external', '_io', 'marshal', 'posix', 'zipimport', 'encodings', 'codecs', '_codecs', 'encodings.aliases', 'encodings.utf_8', '_signal', '__main__', 'encodings.latin_1', 'io', 'abc', '_weakrefset', 'site', 'os', 'errno', 'stat', '_stat', 'posixpath', 'genericpath', 'os.path', '_collections_abc', '_sitebuiltins', 'sysconfig', '_sysconfigdata', '_bootlocale', '_locale', 'types', 'functools', '_functools', 'collections', 'operator', '_operator', 'keyword', 'heapq', '_heapq', 'itertools', 'reprlib', '_collections', 'weakref', 'collections.abc', 'mpl_toolkits', 'time', 'matplotlib', '__future__', 'six', 'struct', '_struct', 'contextlib', 'distutils', 'distutils.version', 're', 'enum', 'sre_compile', '_sre', 'sre_parse', 'sre_constants', 'copyreg', 'distutils.sysconfig', 'distutils.errors', 'inspect', 'ast', '_ast', 'dis', 'opcode', '_opcode', 'importlib', 'importlib._bootstrap', 'importlib._bootstrap_external', 'warnings', 'importlib.machinery', 'linecache', 'tokenize', 'token', 'locale', 'tempfile', 'shutil', 'fnmatch', 'zlib', 'bz2', '_compression', 'threading', 'traceback', '_bz2', 'lzma', '_lzma', 'pwd', 'grp', 'random', 'math', 'hashlib', '_hashlib', '_blake2', '_sha3', 'bisect', '_bisect', '_random', 'matplotlib.cbook', 'six.moves', 'datetime', '_datetime', 'glob', 'gzip', 'numbers', 'matplotlib.cbook.deprecation', 'numpy', 'numpy._globals', 'numpy.__config__', 'numpy.version', 'numpy._import_tools', 'numpy.add_newdocs', 'numpy.lib', 'numpy.lib.info', 'numpy.lib.type_check', 'numpy.core', 'numpy.core.info', 'numpy.core.multiarray', 'numpy.core.umath', 'numpy.core._internal', 'numpy.compat', 'numpy.compat._inspect', 'numpy.compat.py3k', 'pathlib', 'ntpath', 'urllib', 'urllib.parse', 'ctypes', '_ctypes', 'ctypes._endian', 'numpy.core.numerictypes', 'numpy.core.numeric', 'pickle', '_compat_pickle', '_pickle', 'numpy.core.arrayprint', 'numpy.core.fromnumeric', 'numpy.core._methods', 'numpy.core.defchararray', 'numpy.core.records', 'numpy.core.memmap', 'numpy.core.function_base', 'numpy.core.machar', 'numpy.core.getlimits', 'numpy.core.shape_base', 'numpy.core.einsumfunc', 'numpy.testing', 'unittest', 'unittest.result', 'unittest.util', 'unittest.case', 'difflib', 'logging', 'string', '_string', 'atexit', 'pprint', 'unittest.suite', 'unittest.loader', 'unittest.main', 'argparse', 'copy', 'textwrap', 'gettext', 'unittest.runner', 'unittest.signals', 'signal', 'numpy.testing.decorators', 'numpy.testing.utils', 'numpy.lib.utils', 'numpy.testing.nosetester', 'numpy.lib.ufunclike', 'numpy.lib.index_tricks', 'numpy.lib.function_base', 'numpy.lib.twodim_base', 'numpy.matrixlib', 'numpy.matrixlib.defmatrix', 'numpy.lib.stride_tricks', 'numpy.lib.nanfunctions', 'numpy.lib.shape_base', 'numpy.lib.scimath', 'numpy.lib.polynomial', 'numpy.linalg', 'numpy.linalg.info', 'numpy.linalg.linalg', 'numpy.linalg.lapack_lite', 'numpy.linalg._umath_linalg', 'numpy.lib.arraysetops', 'numpy.lib.npyio', 'numpy.lib.format', 'numpy.lib._datasource', 'numpy.lib._iotools', 'numpy.lib.financial', 'numpy.lib.arrayterator', 'numpy.lib.arraypad', 'numpy.lib._version', 'numpy._distributor_init', 'numpy.fft', 'numpy.fft.info', 'numpy.fft.fftpack', 'numpy.fft.fftpack_lite', 'numpy.fft.helper', 'numpy.polynomial', 'numpy.polynomial.polynomial', 'numpy.polynomial.polyutils', 'numpy.polynomial._polybase', 'numpy.polynomial.chebyshev', 'numpy.polynomial.legendre', 'numpy.polynomial.hermite', 'numpy.polynomial.hermite_e', 'numpy.polynomial.laguerre', 'numpy.random', 'numpy.random.info', 'mtrand', 'numpy.random.mtrand', 'numpy.ctypeslib', 'numpy.ma', 'numpy.ma.core', 'numpy.ma.extras', 'matplotlib.cbook._backports', 'matplotlib.compat', 'matplotlib.compat.subprocess', 'subprocess', '_posixsubprocess', 'select', 'selectors', 'matplotlib.rcsetup', 'matplotlib.fontconfig_pattern', 'pyparsing', 'matplotlib.colors', 'matplotlib._color_data', 'cycler', 'six.moves.urllib', 'six.moves.urllib.request', 'urllib.request', 'base64', 'binascii', 'email', 'http', 'http.client', 'email.parser', 'email.feedparser', 'email.errors', 'email._policybase', 'email.header', 'email.quoprimime', 'email.base64mime', 'email.charset', 'email.encoders', 'quopri', 'email.utils', 'socket', '_socket', 'email._parseaddr', 'calendar', 'email.message', 'uu', 'email._encoded_words', 'email.iterators', 'ssl', 'ipaddress', '_ssl', 'urllib.error', 'urllib.response', 'matplotlib._version', 'json', 'json.decoder', 'json.scanner', '_json', 'json.encoder', 'dateutil', 'dateutil._version']
    2.1.x
    CACHEDIR=/root/.cache/matplotlib
    font search path ['/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf', '/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/afm', '/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts']
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf
    trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf
    createFontDict: /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf
    createFontDict: /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf
    terminate called after throwing an instance of 'char const*'
    Aborted
    
  5. anntzer commented on Oct 3, 2017

    Contributor

    Do you have instructions on how to reproduce your setup, possibly using docker? (would something like https://wiki.openwrt.org/doc/howto/docker_openwrt_image work?) (e.g., how did you install python etc.)

  6. jwbrack commented on Oct 4, 2017

    Author

    Python / matplotlib / etc are all compiled into the firmware image. I had to add a missing package to LEDE 17.01.02 (numpy), and add in python3 support for others (pytz, pyparsing, dateutil, cycler, and six), but everything else is stock in the build environment (including both libfreetype and libpng). This is all based on the commit tag "v17.01.2" for the LEDE project (last major release).

    I attempted to build for docker (x86 architecture), but testing here shows as success in loading matplotlib.pyplot (no errors in freetype). Note that the original target is the BRCM 2708 (Raspberry Pi 3). This seems to point that there is some possible issue in cross-compiling for ARM architectures, and passing down the flags appropriately (should happen transparently in buildroot systems). See below for the makefile:

    include $(TOPDIR)/rules.mk
    
    PKG_NAME:=matplotlib
    PKG_VERSION:=2.1.x
    PKG_RELEASE:=1
    PKG_MAINTAINER:=Matplotlib Development Team <matplotlib-devel@python.org>
    PKG_LICENSE:=PSF
    
    PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
    PKG_SOURCE_URL:=https://github.com/matplotlib/matplotlib.git
    PKG_SOURCE_PROTO:=git
    PKG_SOURCE_VERSION:=f2c8faeccc67fd8a4a8e1ea991f30a67af53d162
    PKG_BUILD_DEPENDS:=+python3/host +python3-numpy/host +python3-setuptools/host +python3-dateutil/host +libpng/host +libfreetype/host +python3-six/host +python3-pytz/host +python3-cycler/host +libstdcpp +python3-pyparsing/host
    
    include $(INCLUDE_DIR)/package.mk
    
    $(call include_mk, python3-package.mk)
    
    define Package/python3-matplotlib
      SUBMENU:=Python
      SECTION:=lang
      CATEGORY:=Languages
      TITLE:=matplotlib
      URL:=https://github.com/matplotlib/matplotlib
      DEPENDS:=+python3 +python3-numpy +python3-setuptools +python3-dateutil +libpng +libfreetype +python3-six +python3-pytz +python3-cycler +libstdcpp +python3-pyparsing
    endef
    
    define Package/python3-matplotlib/description
      Matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms.
    endef
    
    define Build/Compile
    	$(call Build/Compile/Py3Mod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
    endef
    
    define Package/python3-matplotlib/install
    	$(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
    	$(CP) \
    		$(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
    		$(1)$(PYTHON_PKG_DIR)
    endef
    
    $(eval $(call BuildPackage,python3-matplotlib))
    

    Added patch to modify the destdirs to point to the arm compiled packages:

    +[directories]
    +# Uncomment to override the default basedir in setupext.py.
    +# This can be a single directory or a comma-delimited list of directories.
    +basedirlist =<PATH TO REPO>/source/staging_dir/target-arm_cortex-a53+neon-vfpv4_musl-1.1.16_eabi/root-brcm2708/usr/, <PATH TO REPO>/source/staging_dir/target-arm_cortex-a53+neon-vfpv4_musl-1.1.16_eabi/root-brcm2708/usr/lib/python3.6/site-packages/
    

    I'm attempting a QEMU ARM image now, and will upload with success. Else, I have a Raspberrry Pi 3 image ready to go at any time. Am I able to directly upload the firmware images here?

  7. anntzer commented on Oct 4, 2017

    Contributor

    tbh I'm not super familiar (actually, not at all) with the general docker ecosystem, but I guess you can use https://quay.io/ similarly to https://github.com/pypa/manylinux (which is the only image I've interacted with so far :p).

  8. jwbrack commented on Oct 4, 2017

    Author

    Issue is not with the docker. A docker image (compiled against x86, which is the native build environment) architecture works just fine for loading in matplotlib,pyplot, which makes it seem that this is an issue with cross-compiling to an ARM architecture. Docker is not a real virtual machine, that is the architecture in the docked image must match that of the host. Thus why I am trying to compile against a QEMU arm virtual machine to see if I have any success there in re-creating the error.

    For more on armvirt:
    https://lede-project.org/docs/guide-developer/test-virtual-image-using-armvirt

  9. anntzer commented on Oct 4, 2017

    Contributor

    Just to be clear, I don't think I have the knowledge to test a full VM.

  10. jwbrack commented on Oct 4, 2017

    Author

    How about I put my Raspi somewhere publicly accessible with the build on it? That way you can just ssh into the box for access, and do all your testing there.

  11. anntzer commented on Oct 4, 2017

    Contributor

    Go for it. email me to firstname.lastname@berkeley.edu

  12. jwbrack commented on Oct 4, 2017

    Author

    Sent an email.

  13. jwbrack commented on Oct 6, 2017

    Author

    Determined the root issue after instrumenting the code a bit. The font list cache file (fontList.json) is not being generated. See failure below. It seems a similar issue was found in #5406, but no resolution was really added there.

    createFontDict: /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf
    mpl_PyFile_DupClose(): Call to PyObject_CallMethod() failed
    mpl_PyFile_DupClose(): Python error occured - printing traceback
    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/matplotlib/font_manager.py", line 1444, in <module>
        fontManager = json_load(_fmcache)
      File "/usr/lib/python3.6/site-packages/matplotlib/font_manager.py", line 973, in json_load
        with open(filename, 'r') as fh:
    FileNotFoundError: [Errno 2] No such file or directory: '/root/.cache/matplotlib/fontList.json'
    
    During handling of the above exception, another exception occurred:
    
    ValueError: whence value 217555 unsupported
    terminate called after throwing an instance of 'std::runtime_error'
      what():  Couldn't close file
    Aborted
    
  14. anntzer commented on Oct 6, 2017

    Contributor

    Actually the error occurs while trying to open the not-yet-existent cache (which should normally trigger a normal exception that leads to the file being generated).
    I assume the error occurs at the line

            ret = PyObject_CallMethod(file, (char *)"seek", (char *)(MPL_OFF_T_PYFMT "i"), position, 0);

    ?
    On the CPython side the error seems to occur in bufferedio.c: _io__Buffered_seek_impl:

        /* Do some error checking instead of trusting OS 'seek()'
        ** error detection, just in case.
        */
        if ((whence < 0 || whence >2)
    #ifdef SEEK_HOLE
            && (whence != SEEK_HOLE)
    #endif
    #ifdef SEEK_DATA
            && (whence != SEEK_DATA)
    #endif
            ) {
            PyErr_Format(PyExc_ValueError,
                         "whence value %d unsupported", whence);
            return NULL;
        }

    but looking at the mpl code it looks like whence should be zero. Can you check that this is indeed where the error happens? That somehow an invalid value of 217555 reaches _io__Buffered_seek_impl? (Yes that probably means recompiling cpython, if you can't get gdb to work...)

  15. zokl commented on Oct 30, 2017

    Hello,

    i'm trying to compile the matte run on LEDE and the x86-64 platform, version 1.4.3 is seamless and everything works from 1.5.3 I have a similar problem in compilation. Can you expose your compilation packages to matplotlib?

    Thank you, zbynek Kocur

  16. anntzer commented on Dec 3, 2017

    Contributor

    @jwbrack Perhaps #9763 could help? It is a complete rewrite of ft2font, which in particular doesn't rely on the old file API (but needs a very recent compiler).

  17. zokl commented on Dec 3, 2017

    Thank you @jwbrack , i will try it.

  18. github-actions commented on Apr 19, 2023

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  19. anntzer commented on Apr 19, 2023

    Contributor

    Especially with the move to pybind11 the situation likely changed; let's close this and track this on a new issue if needed.

    In particular, in 97477d7 the line that throws the exception mentioned originally was removed; now we call PyErr_WriteUnraisable if an error occurs in the file close.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: inactiveMarked by the “Stale” Github Action

    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