Skip to content

TeX preamble breaks with Matplotlib pre-release

Created by: alurban

I'm seeing a build failure downstream in gwsumm when running pip install --upgrade --pre:

gwsumm/globalv.py:25: in <module>
    from gwpy.time import to_gps
../../../virtualenv/python3.6.7/lib/python3.6/site-packages/gwpy/__init__.py:35: in <module>
    from . import (
../../../virtualenv/python3.6.7/lib/python3.6/site-packages/gwpy/plot/__init__.py:29: in <module>
    from . import (
../../../virtualenv/python3.6.7/lib/python3.6/site-packages/gwpy/plot/rc.py:79: in <module>
    rcParams.get('text.latex.preamble', []) + tex.MACROS),
E   TypeError: must be str, not list

The issue stems from line 79 of gwpy.plot.rc, which defines the LaTeX preamble needed to support gwpy's TeX macros.

After a bit of digging, I believe the ultimate cause of the build failure is that in the pre-release of Matplotlib's 3.1 series there have been some API changes to setting LaTeX code in matplotlibrc files.