X Tutup
Skip to content

Make matplotlib.use() report where the backend was set first, in case of conflict #7287

@anntzer

Description

@anntzer

Currently, calling matplotlib.use(...) when a (different) backend is already set results in the warning

/usr/lib/python3.5/site-packages/matplotlib/__init__.py:1391: UserWarning:  This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

It would be helpful for debugging purposes if this also reported where the backend was set for the first time. This could be done, e.g., by saving the traceback (in text form) whenever matplotlib.backends is imported for the first time, and display that traceback in the later warning (perhaps only if the verbose flag is set).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup