8000 [BUG]: error occured after execute second plot_model · Issue #4084 · pycaret/pycaret · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[BUG]: error occured after execute second plot_model #4084

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

Open
2 of 3 tasks
AndreasKarasenko opened this issue Oct 30, 2024 · 0 comments
Open
2 of 3 tasks

[BUG]: error occured after execute second plot_model #4084

AndreasKarasenko opened this issue Oct 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@AndreasKarasenko
Copy link

pycaret version checks

Issue Description

Necroing #3581 since it remains in pycaret v3.3.2.
I can run the code in interactive sessions (either in terminal or an ipykernel), but if I execute the same script using python <script.py> it crashes with the below error. I still see the errors when using it via the terminal.

Reproducible Example

# the same as #3581
from pycaret.datasets import get_data
from pycaret.classification import *

juice = get_data('juice')  
setup(data=juice,  target='Purchase')
logr = create_model('lr')
tuned_logr = tune_model(logr) 

plot_model(estimator = tuned_logr, plot = 'feature_all')
plot_model(estimator = tuned_logr, plot = 'confusion_matrix') 
plot_model(estimator = tuned_logr, plot = 'auc') 
plot_model(estimator = tuned_logr, plot = 'pr') 
plot_model(estimator = tuned_logr, plot = 'error')

Expected Behavior

all plot show display without error

Actual Results

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/pycaret/utils/generic.py", line 964, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/pycaret/classification/functional.py", line 1725, in plot_model
    return _CURRENT_EXPERIMENT.plot_model(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/pycaret/classification/oop.py", line 2071, in plot_model
    return super().plot_model(
           ^^^^^^^^^^^^^^^^^^^
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/pycaret/internal/pycaret_experiment/tabular_experiment.py", line 2045, in plot_model
    return self._plot_model(
           ^^^^^^^^^^^^^^^^^
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/pycaret/internal/pycaret_experiment/tabular_experiment.py", line 1913, in _plot_model
    ret = locals()[plot]()
          ^^^^^^^^^^^^^^^^
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/pycaret/internal/pycaret_experiment/tabular_experiment.py", line 1227, in error
    return show_yellowbrick_plot(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/pycaret/internal/plots/yellowbrick.py", line 115, in show_yellowbrick_plot
    visualizer.show(clear_figure=True)
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/yellowbrick/base.py", line 249, in show
    self.fig.clear()
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/matplotlib/figure.py", line 3148, in clear
    super().clear(keep_observers=keep_observers)
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/matplotlib/figure.py", line 978, in clear
    self.delaxes(ax)  # Remove ax from self._axstack.
    ^^^^^^^^^^^^^^^^
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/matplotlib/figure.py", line 945, in delaxes
    self._axobservers.process("_axes_change_event", self)
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/matplotlib/cbook/__init__.py", line 319, in process
    self.exception_handler(exc)
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/matplotlib/cbook/__init__.py", line 103, in _exception_printer
    raise exc
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/matplotlib/cbook/__init__.py", line 314, in process
    func(*args, **kwargs)
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/matplotlib/figure.py", line 3253, in <lambda>
    self._axobservers.connect("_axes_change_event", lambda arg: func(arg))
                                                                ^^^^^^^^^
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/matplotlib/backend_bases.py", line 2848, in notify_axes_change
    self.toolbar.update()
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/matplotlib/backend_bases.py", line 3382, in update
    self.set_history_buttons()
  File "/home/andreas/projects/fp_dm/.venv/lib/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 892, in set_history_buttons
    self._buttons['Back']['state'] = state_map[can_back]
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/lib/python3.11/tkinter/__init__.py", line 1735, in __setitem__
    self.configure({key: value})
  File "/usr/lib/python3.11/tkinter/__init__.py", line 1724, in configure
    return self._configure('configure', cnf, kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/tkinter/__init__.py", line 1714, in _configure
    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: invalid command name ".!navigationtoolbar2tk.!button2"

Installed Versions

System: python: 3.11.6 (main, Oct 23 2023, 22:47:21) [GCC 9.4.0] executable: /home/andreas/projects/fp_dm/.venv/bin/python machine: Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.31

PyCaret required dependencies:
pip: 24.3.1
setuptools: 75.3.0
pycaret: 3.3.2
IPython: 8.29.0
ipywidgets: 8.1.5
tqdm: 4.66.6
numpy: 1.26.4
pandas: 2.1.4
jinja2: 3.1.4
scipy: 1.11.4
joblib: 1.3.2
sklearn: 1.4.2
pyod: 2.0.2
imblearn: 0.12.4
category_encoders: 2.6.4
lightgbm: 4.5.0
numba: 0.60.0
requests: 2.32.3
matplotlib: 3.7.5
scikitplot: 0.3.7
yellowbrick: 1.5
plotly: 5.24.1
plotly-resampler: Not installed
kaleido: 0.2.1
schemdraw: 0.15
statsmodels: 0.14.4
sktime: 0.26.0
tbats: 1.1.3
pmdarima: 2.0.4
psutil: 6.1.0
markupsafe: 3.0.2
pickle5: Not installed
cloudpickle: 3.1.0
deprecation: 2.1.0
xxhash: 3.5.0
wurlitzer: 3.1.1

PyCaret optional dependencies:
shap: Not installed
interpret: Not installed
umap: Not installed
ydata_profiling: Not installed
explainerdashboard: Not installed
autoviz: Not installed
fairlearn: Not installed
deepchecks: Not installed
xgboost: Not installed
catboost: Not installed
kmodes: Not installed
mlxtend: Not installed
statsforecast: Not installed
tune_sklearn: Not installed
ray: Not installed
hyperopt: Not installed
optuna: Not installed
skopt: Not installed
mlflow: Not installed
gradio: Not installed
fastapi: Not installed
uvicorn: Not installed
m2cgen: Not installed
evidently: Not installed
fugue: Not installed
streamlit: Not installed
prophet: Not installed

@AndreasKarasenko AndreasKarasenko added the bug Something isn't working label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant
0