Skip to content

Dependence on tikzplotlib makes netcal.presentation unusable #62

@vitawasalreadytaken

Description

@vitawasalreadytaken

Hi, thank you for this useful library.

I ran into problems just attempting to import netcal.presentation. This leads to the following error: ImportError: cannot import name 'common_texification' from 'matplotlib.backends.backend_pgf' (redacted/.venv/lib/python3.12/site-packages/matplotlib/backends/backend_pgf.py) (I am pasting the full trace below).

Versions:

Python 3.12.1

matplotlib==3.10.3
netcal==1.3.5
tikzplotlib==0.9.8

According to this discussion this is due to tikzplot being effectively unmaintained, and not fixing this well-known issue: nschloe/tikzplotlib#559

Indeed, when I inject matplot2tikz into imported modules before importing anything from netcal everything works perfectly 🎉

import sys
import matplot2tikz
sys.modules["tikzplotlib"] = matplot2tikz

Maybe you would consider switching to matplot2tikz instead of tikzplotlib? 🙏

Full ImportError stack trace
File redacted/.venv/lib/python3.12/site-packages/netcal/presentation/__init__.py:25
      1 # Copyright (C) 2019-2023 Ruhr West University of Applied Sciences, Bottrop, Germany
      2 # AND e:fs TechHub GmbH, Gaimersheim, Germany
      3 #
      4 # This Source Code Form is subject to the terms of the Apache License 2.0
      5 # If a copy of the APL2 was not distributed with this
      6 # file, You can obtain one at https://www.apache.org/licenses/LICENSE-2.0.txt.
      8 """
      9 .. include:: /../../netcal/presentation/README.md
     10    :parser: myst_parser.sphinx_
   (...)     21    ReliabilityQCE
     22 """
---> 25 from .ReliabilityDiagram import ReliabilityDiagram
     26 from .ReliabilityRegression import ReliabilityRegression
     27 from .ReliabilityQCE import ReliabilityQCE

File redacted/.venv/lib/python3.12/site-packages/netcal/presentation/ReliabilityDiagram.py:14
     11 from scipy.interpolate import interp1d, griddata
     13 import matplotlib.pyplot as plt
---> 14 import tikzplotlib
     16 from netcal.metrics.Miscalibration import _Miscalibration
     19 class ReliabilityDiagram(object):

File redacted/.venv/lib/python3.12/site-packages/tikzplotlib/__init__.py:5
      3 from .__about__ import __version__
      4 from ._cleanfigure import clean_figure
----> 5 from ._save import Flavors, get_tikz_code, save
      7 __all__ = [
      8     "__version__",
      9     "get_tikz_code",
   (...)     12     "Flavors",
     13 ]

File redacted/.venv/lib/python3.12/site-packages/tikzplotlib/_save.py:11
      8 import matplotlib as mpl
      9 import matplotlib.pyplot as plt
---> 11 from . import _axes
     12 from . import _image as img
     13 from . import _legend, _line2d, _patch, _path

File redacted/.venv/lib/python3.12/site-packages/tikzplotlib/_axes.py:3
      1 import matplotlib as mpl
      2 import numpy as np
----> 3 from matplotlib.backends.backend_pgf import (
      4     common_texification as mpl_common_texification,
      5 )
      7 from . import _color
     10 def _common_texification(string):
     11     # Work around <https://github.com/matplotlib/matplotlib/issues/15493>

ImportError: cannot import name 'common_texification' from 'matplotlib.backends.backend_pgf' (redacted/.venv/lib/python3.12/site-packages/matplotlib/backends/backend_pgf.py)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions