The Wayback Machine - https://web.archive.org/web/20240110190107/https://github.com/matplotlib/matplotlib/issues/27558
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

[MNT]: Tkinter possible indirect matplotlib problems #27558

Closed
celestinoxp opened this issue Dec 22, 2023 · 1 comment
Closed

[MNT]: Tkinter possible indirect matplotlib problems #27558

celestinoxp opened this issue Dec 22, 2023 · 1 comment

Comments

@celestinoxp
Copy link

celestinoxp commented Dec 22, 2023

Summary

I'm upgrading pycaret so support scikit-learn 1.4, however some problems affect tests. I don´t know if its a matplolib bug or not:
traceback:


c:\Users\celes\pycaret\tests\test_regression_plots.py::test_plot failed: @pytest.mark.plotting
    def test_plot():
        # loading dataset
        data = pycaret.datasets.get_data("boston")
        assert isinstance(data, pd.DataFrame)
    
        # init setup
        pycaret.regression.setup(
            data,
            target="medv",
            log_experiment=True,
            log_plots=True,
            html=False,
            session_id=123,
            fold=2,
            n_jobs=1,
        )
    
        model = pycaret.regression.create_model("rf", max_depth=2, n_estimators=5)
    
        exp = pycaret.regression.RegressionExperiment()
        available_plots = exp._available_plots
    
        for plot in available_plots:
>           pycaret.regression.plot_model(model, plot=plot)

C:\Users\celes\pycaret\tests\test_regression_plots.py:32: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
c:\Users\celes\pycaret\pycaret\utils\generic.py:964: in wrapper
    return func(*args, **kwargs)
C:\Users\celes\pycaret\pycaret\regression\functional.py:1646: in plot_model
    return _CURRENT_EXPERIMENT.plot_model(
c:\Users\celes\pycaret\pycaret\regression\oop.py:1946: in plot_model
    return super().plot_model(
c:\Users\celes\pycaret\pycaret\internal\pycaret_experiment\tabular_experiment.py:2045: in plot_model
    return self._plot_model(
c:\Users\celes\pycaret\pycaret\internal\pycaret_experiment\tabular_experiment.py:1913: in _plot_model
    ret = locals()[plot]()
c:\Users\celes\pycaret\pycaret\internal\pycaret_experiment\tabular_experiment.py:1122: in residuals
    return show_yellowbrick_plot(
C:\Users\celes\pycaret\pycaret\internal\plots\yellowbrick.py:115: in show_yellowbrick_plot
    visualizer.show(clear_figure=True)
c:\Users\celes\pycaret\.venv\lib\site-packages\yellowbrick\base.py:249: in show
    self.fig.clear()
c:\Users\celes\pycaret\.venv\lib\site-packages\matplotlib\figure.py:3127: in clear
    super().clear(keep_observers=keep_observers)
c:\Users\celes\pycaret\.venv\lib\site-packages\matplotlib\figure.py:996: in clear
    self.delaxes(ax)  # Remove ax from self._axstack.
c:\Users\celes\pycaret\.venv\lib\site-packages\matplotlib\figure.py:939: in delaxes
    self._remove_axes(ax, owners=[self._axstack, self._localaxes])
c:\Users\celes\pycaret\.venv\lib\site-packages\matplotlib\figure.py:956: in _remove_axes
    self._axobservers.process("_axes_change_event", self)
c:\Users\celes\pycaret\.venv\lib\site-packages\matplotlib\cbook.py:303: in process
    self.exception_handler(exc)
c:\Users\celes\pycaret\.venv\lib\site-packages\matplotlib\cbook.py:87: in _exception_printer
    raise exc
c:\Users\celes\pycaret\.venv\lib\site-packages\matplotlib\cbook.py:298: in process
    func(*args, **kwargs)
c:\Users\celes\pycaret\.venv\lib\site-packages\matplotlib\figure.py:3232: in <lambda>
    self._axobservers.connect("_axes_change_event", lambda arg: func(arg))
c:\Users\celes\pycaret\.venv\lib\site-packages\matplotlib\backend_bases.py:2676: in notify_axes_change
    self.toolbar.update()
c:\Users\celes\pycaret\.venv\lib\site-packages\matplotlib\backend_bases.py:3210: in update
    self.set_history_buttons()
c:\Users\celes\pycaret\.venv\lib\site-packages\matplotlib\backends\_backend_tk.py:897: in set_history_buttons
    self._buttons['Back']['state'] = state_map[can_back]
c:\Users\celes\anaconda3\lib\tkinter\__init__.py:1686: in __setitem__
    self.configure({key: value})
c:\Users\celes\anaconda3\lib\tkinter\__init__.py:1675: in configure
    return self._configure('configure', cnf, kw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <tkinter.Button object .!navigationtoolbar2tk.!button2>
cmd = 'configure', cnf = {'state': 'disabled'}, kw = {}

    def _configure(self, cmd, cnf, kw):
        """Internal function."""
        if kw:
            cnf = _cnfmerge((cnf, kw))
        elif cnf:
            cnf = _cnfmerge(cnf)
        if cnf is None:
            return self._getconfigure(_flatten((self._w, cmd)))
        if isinstance(cnf, str):
            return self._getconfigure1(_flatten((self._w, cmd, '-'+cnf)))
>       self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
E       _tkinter.TclError: invalid command name ".!navigationtoolbar2tk.!button2"

c:\Users\celes\anaconda3\lib\tkinter\__init__.py:1665: TclError

Proposed fix

investigate why show this error

@jklymak
Copy link
Member

jklymak commented Dec 22, 2023

Please isolate as a Matplotlib error using numpy. We are unlikely to debug pycaret testing suite Also please format bug reports if possible. https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax

I'm going to close this as unlikely an issue on our end. However if you have a reproducible error, please feel free to ask us to reopen.

@jklymak jklymak closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants