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

AttributeError: 'FigureCanvasAgg' object has no attribute 'tostring_rgb' #2411

Open
Mehmet2407 opened this issue Dec 14, 2024 · 14 comments
Open

Comments

@Mehmet2407
Copy link

Whenever I press "train model" it goes up to 5.3 seconds and then says error on the progress bar. The command window shows this error in the last line. I have no idea what's wrong

@kunibald413
Copy link

same here

@Sol-III-Observer
Copy link

+1

@kunibald413
Copy link

kunibald413 commented Dec 15, 2024

i think this might be only related to tensorboard logs
if you don't need them you can just comment out the code or skip it

in infer/lib/train/utils.py find the summarize function and try catch it

def summarize(
    writer,
    global_step,
    scalars={},
    histograms={},
    images={},
    audios={},
    audio_sampling_rate=22050,
):
    try:
        for k, v in scalars.items():
            writer.add_scalar(k, v, global_step)
        for k, v in histograms.items():
            writer.add_histogram(k, v, global_step)
        for k, v in images.items():
            writer.add_image(k, v, global_step, dataformats="HWC")
        for k, v in audios.items():
            writer.add_audio(k, v, global_step, audio_sampling_rate)
    except Exception as e:
        print(f"Exception when summarizing  {e}. Skip, we don't care!")

@5uperninj4
Copy link

+1. Looking for solution

@xpdd123
Copy link

xpdd123 commented Dec 20, 2024

pip install matplotlib==3.7.0,
It work for me

@TheTrustedComputer
Copy link

I also faced this error in the terminal window once training started. The workaround is downgrading matplotlib to 3.9 with: pip install matplotlib<3.10, likely due to breaking API changes with 3.10.

@anurag12-webster
Copy link

same, downgrading to pip install matplotlib==3.7.0 worked for me,

@Charles-yueyue831
Copy link

pip install matplotlib==3.7.0, It work for me

I agree with you

@cahayamahardika16
Copy link

cahayamahardika16 commented Jan 9, 2025

But you got this error thing was matplotlib this expired.
Capture 253

@meisei4
Copy link

meisei4 commented Jan 10, 2025

I think this might be related? (matplotlib/matplotlib#25484), I am not using this repos software, but i am using matplotlib version 3.10 and getting this error from trying to show plots in the jetbrains IDE PyCharm 2024.1.3 (Professional Edition, Runtime version: 17.0.11+1-b1207.24 x86_64, macOS 12.7.6) viewer:

trace:

...
lib/python3.12/site-packages/matplotlib/pyplot.py", line 614, in show
    return _get_backend_mod().show(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 41, in __call__
    manager.show(**kwargs)
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 144, in show
    self.canvas.show()
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 85, in show
    buffer = self.tostring_rgb()
             ^^^^^^^^^^^^^^^^^
AttributeError: 'FigureCanvasInterAgg' object has no attribute 'tostring_rgb'. Did you mean: 'tostring_argb'?

Process finished with exit code 1
...

Workaround is using matplotlib version 3.9.4 and below i think... (at least i tested with 3.9.4 and that solved my issue

@cahayamahardika16
Copy link

I got failure Preprocessing and Feature Extraction "AttributeError: 'NoneType' object has no attribute 'loader'"

@BoyceCecil
Copy link

I am pretty sure the update of the matplotlib break its support with seaborn

@ikamensh
Copy link

someone should report this to matplotlib. I got this error while plotting generic data.

@FHeizenberg
Copy link

I had the same problem and the following helps me:
`import matplotlib

matplotlib.use('TkAgg')`
You can try to select another backend manually, here is the documentation https://matplotlib.org/stable/users/explain/figure/backends.html

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