10000 Can't import pyspeckit after upgrading to Matplotlib 3.0 · Issue #286 · pyspeckit/pyspeckit · GitHub
[go: up one dir, main page]

Skip to content
Can't import pyspeckit after upgrading to Matplotlib 3.0 #286
@tomr-stargazer

Description

@tomr-stargazer

When I try to import pyspeckit (using today's 0.1.21.dev2815 version), I get this error:

pyspeckit git:(master) python
Python 3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 11:07:29)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyspeckit
Traceback (most recent call last):
  File "/Users/tsrice/Documents/Code/cloned_projects/pyspeckit/pyspeckit/spectrum/plotters.py", line 18, in <module>
    from matplotlib.cbook import BoundMethodProxy
ImportError: cannot import name 'BoundMethodProxy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tsrice/Documents/Code/cloned_projects/pyspeckit/pyspeckit/__init__.py", line 10, in <module>
    from . import spectrum
  File "/Users/tsrice/Documents/Code/cloned_projects/pyspeckit/pyspeckit/spectrum/__init__.py", line 3, in <module>
    from .classes import Spectrum,Spectra,ObsBlock
  File "/Users/tsrice/Documents/Code/cloned_projects/pyspeckit/pyspeckit/spectrum/classes.py", line 26, in <module>
    from . import plotters
  File "/Users/tsrice/Documents/Code/cloned_projects/pyspeckit/pyspeckit/spectrum/plotters.py", line 20, in <module>
    from matplotlib.cbook import _BoundMethodProxy as BoundMethodProxy
ImportError: cannot import name '_BoundMethodProxy'

I think this is related to a change in how Matplotlib 3.0 handles callbacks, but I'm not 100% sure:
https://matplotlib.org/api/api_changes.html#callbackregistry-now-stores-callbacks-using-stdlib-s-weakmethods

CallbackRegistry now stores callbacks using stdlib's WeakMethods

In particular, this implies that CallbackRegistry.callbacks[signal] is now a mapping of callback ids to WeakMethods (i.e., they need to be first called with no arguments to retrieve the method itself).

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

      0