Skip to content

Cannot import pyplot. NameError: 'FigureManagerWebAgg' is not defined #9380

Closed

Description

@cknd

Bug report

When using the webagg backend on 2.1.0, importing pyplot fails with a NameError.

Code for reproduction

import matplotlib
matplotlib.use('WebAgg')
from matplotlib import pyplot

Actual outcome

I get a name error. traceback excerpt:

.../python3.6/site-packages/matplotlib/backends/__init__.py in pylab_setup(name)
     58     # imports. 0 means only perform absolute imports.
     59     backend_mod = __import__(backend_name, globals(), locals(),
---> 60                              [backend_name], 0)
     61 
     62     # Things we pull in from all backends

.../python3.6/site-packages/matplotlib/backends/backend_webagg.py in <module>()
    325 
    326 @_Backend.export
--> 327 class _BackendWebAgg(_Backend):
    328     FigureCanvas = FigureCanvasWebAgg
    329     FigureManager = FigureManagerWebAgg

.../python3.6/site-packages/matplotlib/backends/backend_webagg.py in _BackendWebAgg()
    327 class _BackendWebAgg(_Backend):
    328     FigureCanvas = FigureCanvasWebAgg
--> 329     FigureManager = FigureManagerWebAgg
    330 
    331     @staticmethod

NameError: name 'FigureManagerWebAgg' is not defined

Matplotlib version

  • Operating system: Mac OS 10.12.6
  • Matplotlib version: 2.1.0
  • Matplotlib backend (print(matplotlib.get_backend())): WebAgg
  • Python version: Python 3.6.2
  • Jupyter version (if applicable): -
  • Other libraries:

I installed matplotlib via pip.

Activity

  1. cknd commented on Oct 12, 2017

    @cknd
    ContributorAuthor

    cursory glance suggests that FigureManagerWebAgg has simply moved to core. this works on my machine:

    # in matplotlib/backends/backend_webagg.py,  line 329
    @_Backend.export
    class _BackendWebAgg(_Backend):
        FigureCanvas = FigureCanvasWebAgg
        FigureManager = core.FigureManagerWebAgg   # !

    (I'm on the go and can't make a proper PR right now. also not sure this is a complete fix - I can import pyplot now, but when I show a figure, the browser window opens with the "WebAgg current figures" title but stays blank)

  2. anntzer commented on Oct 12, 2017

    @anntzer
    Contributor

    Even with the fix in #9347 this stays broken (with the symptoms described in the second message) bisecting back to #9027.
    Note that while #9027 is supposed to "only" revert #5754, the webagg backend was working even before #5754 was merged, so I guess something got broken during the revert.

  3. added
    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
    on Oct 12, 2017
  4. added this to the milestone on Oct 13, 2017
  5. tacaswell commented on Oct 23, 2017

    @tacaswell
    Member

    The issue is that #6370 fixed webagg for renamed files in #5754 but the reversion did not.

  6. tacaswell commented on Oct 23, 2017

    @tacaswell
    Member

    PR coming shortly....got side-tracked by ipython/ipython#10867

  7. added a commit that references this issue on Oct 23, 2017
    0e688ff
  8. anntzer commented on Nov 1, 2017

    @anntzer
    Contributor

    closed by #9534, afaict

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

    GUI: webaggRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions