Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skimage.viewer: incompatibility with Matplotlib 3.5 #6119

Closed
grlee77 opened this issue Dec 10, 2021 · 5 comments
Closed

skimage.viewer: incompatibility with Matplotlib 3.5 #6119

grlee77 opened this issue Dec 10, 2021 · 5 comments

Comments

@grlee77
Copy link
Contributor

grlee77 commented Dec 10, 2021

Description

The following test fails when run with Matplotlib 3.5.
viewer/tests/test_plugins.py::test_plugin

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> captured stdout >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Crop tool
Select rectangular region and press enter to crop.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    @pytest.mark.skipif(not has_qt, reason="Qt not installed")
    def test_crop():
        image = data.camera()
        viewer = ImageViewer(image)
        c = Crop()
>       viewer += c

viewer/tests/test_plugins.py:129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
viewer/viewers/core.py:155: in __add__
    plugin.attach(self)
viewer/plugins/crop.py:21: in attach
    self.rect_tool = RectangleTool(image_viewer,
viewer/canvastools/recttool.py:80: in __init__
    CanvasToolBase.__init__(self, manager, on_move=on_move,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <skimage.viewer.canvastools.recttool.RectangleTool object at 0x7f8cf89e4f10>, manager = <skimage.viewer.viewers.core.ImageViewer object at 0x7f8cf8a24f70>, on_move = None
on_enter = <bound method Crop.crop of <skimage.viewer.plugins.crop.Crop object at 0x7f8cf89ecaf0>>, on_release = None, useblit = True, ax = None

    def __init__(self, manager, on_move=None, on_enter=None, on_release=None,
                 useblit=True, ax=None):
        self.manager = manager
        self.ax = manager.ax
>       self.artists = []
E       AttributeError: can't set attribute

viewer/canvastools/base.py:33: AttributeError

There are also a number of new deprecation warnings that will become errors in Matplotlib 3.7.

skimage/viewer/qt.py:5: MatplotlibDeprecationWarning: 
  The QT_RC_MAJOR_VERSION attribute was deprecated in Matplotlib 3.5 and will be removed two minor releases later.
    from matplotlib.backends.qt_compat import QtGui, QtCore, QtWidgets, QT_RC_MAJOR_VERSION as _qt_version

skimage/viewer/tests/test_plugins.py::test_crop
skimage/viewer/tests/test_plugins.py::test_color_histogram
  /home/lee8rx/my_git/pyir/scikit-image/skimage/viewer/canvastools/recttool.py:77: MatplotlibDeprecationWarning: The 'rectprops' parameter of __init__() has been renamed 'props' since Matplotlib 3.5; support for the old name will be dropped two minor releases later.
    RectangleSelector.__init__(self, manager.ax, lambda *args: None,

skimage/viewer/tests/test_plugins.py::test_crop
skimage/viewer/tests/test_plugins.py::test_color_histogram
  /home/lee8rx/my_git/pyir/scikit-image/skimage/viewer/canvastools/recttool.py:91: MatplotlibDeprecationWarning: 
  The to_draw attribute was deprecated in Matplotlib 3.5 and will be removed two minor releases later.
    self._rect = self.to_draw

skimage/viewer/tests/test_plugins.py::test_crop
skimage/viewer/tests/test_plugins.py::test_color_histogram
  /home/lee8rx/my_git/pyir/scikit-image/skimage/viewer/canvastools/recttool.py:94: MatplotlibDeprecationWarning: 
  The maxdist attribute was deprecated in Matplotlib 3.5 and will be removed two minor releases later. Use grab_range instead.
    self.maxdist = maxdist

skimage/viewer/tests/test_plugins.py::test_crop
skimage/viewer/tests/test_plugins.py::test_color_histogram
  /home/lee8rx/my_git/pyir/scikit-image/skimage/viewer/canvastools/recttool.py:95: MatplotlibDeprecationWarning: 
  The active_handle attribute was deprecated in Matplotlib 3.5 and will be removed two minor releases later.
    self.active_handle = None

Version information

current v0.19.x branch of scikit-image
Matplotlib 3.5.0

@grlee77
Copy link
Contributor Author

grlee77 commented Dec 10, 2021

Currently, users who wish to use skimage.viewer should pin to matplotlib<3.5. In general we encourage moving to another tool such as napari as the viewer module will be removed in the 1.0 release.

@hmaarrfk
Copy link
Member

seems like a good plan.

@mkcor
Copy link
Member

mkcor commented Dec 14, 2021

Currently, users who wish to use skimage.viewer should pin to matplotlib<3.5.

@grlee77 is this documented somewhere?

@grlee77
Copy link
Contributor Author

grlee77 commented Dec 14, 2021

@grlee77 is this documented somewhere?

just in this issue (Matplotlib 3.5 is only about a month old). doc PR welcome

@mkcor
Copy link
Member

mkcor commented Jan 6, 2022

Closing as per #6133 and #6160.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants