Skip to content

Matplotlib Backends Not Bundled #3887

@krzywon

Description

@krzywon

Describe the bug
As reported through the sasview help email list, exporting graphics to SVG format fails with the error No module named 'matplotlib.backends.backend_svg'. This isn't the only mpl backend missing, but jpeg, png, and raw all work. Most others fail.

Important Note: All mpl backends are included in the pypi and conda packages, so this only fails in the distributables.

To Reproduce
Steps to reproduce the behavior:

  1. Open a plot.
  2. Click on the save icon.
  3. Select Scalable Vector Graphics (*.svg *.svgz).
  4. See error

Expected behavior
The files should be saved in SVG format.

SasView version (please complete the following information):

  • Version: v6.0.1, v6.1.0, v6.1.1, v6.1.2

Operating system (please complete the following information):

  • OS: Windows 11, MacOS (ARM)

Installation method (please complete the following information):

  • Installed: Windows installer, MacOS application

Additional context
Matplotlib hooks need to be explicitly specified in the .spec file to be integrated into the final build. See https://pyinstaller.org/en/stable/hooks.html#PyInstaller.utils.hooks.get_hook_config. We could use the matplotlib.use() at the top of our plotting routines to list all required backends. Also, we could specify all hooks be installed, but we would need to test how much larger the installer becomes.

If the backend isn't specified as used or in the spec file, they won't be bundled in the final build.

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