[GH-ISSUE #2411] AttributeError: 'FigureCanvasAgg' object has no attribute 'tostring_rgb' #1682

Closed
opened 2026-10-20 10:11:06 +00:00 by bsakaguchi · 21 comments
Owner

Originally created by @Mehmet2407 on GitHub (Dec 14, 2024).
Original GitHub issue: https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/issues/2411

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

Originally created by @Mehmet2407 on GitHub (Dec 14, 2024). Original GitHub issue: https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/issues/2411 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
Author
Owner

@kunibald413 commented on GitHub (Dec 15, 2024):

same here

<!-- gh-comment-id:2543885741 --> @kunibald413 commented on GitHub (Dec 15, 2024): same here
Author
Owner

@Sol-III-Observer commented on GitHub (Dec 15, 2024):

+1

<!-- gh-comment-id:2543918512 --> @Sol-III-Observer commented on GitHub (Dec 15, 2024): +1
Author
Owner

@kunibald413 commented on GitHub (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!")
<!-- gh-comment-id:2543923022 --> @kunibald413 commented on GitHub (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 ```py 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!") ```
Author
Owner

@5uperninj4 commented on GitHub (Dec 18, 2024):

+1. Looking for solution

<!-- gh-comment-id:2550605498 --> @5uperninj4 commented on GitHub (Dec 18, 2024): +1. Looking for solution
Author
Owner

@xpdd123 commented on GitHub (Dec 20, 2024):

pip install matplotlib==3.7.0,
It work for me

<!-- gh-comment-id:2556299066 --> @xpdd123 commented on GitHub (Dec 20, 2024): pip install matplotlib==3.7.0, It work for me
Author
Owner

@TheTrustedComputer commented on GitHub (Dec 30, 2024):

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.

<!-- gh-comment-id:2565980769 --> @TheTrustedComputer commented on GitHub (Dec 30, 2024): 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.
Author
Owner

@anurag12-webster commented on GitHub (Jan 1, 2025):

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

<!-- gh-comment-id:2566927653 --> @anurag12-webster commented on GitHub (Jan 1, 2025): same, downgrading to `pip install matplotlib==3.7.0` worked for me,
Author
Owner

@Charles-yueyue831 commented on GitHub (Jan 5, 2025):

pip install matplotlib==3.7.0, It work for me

I agree with you

<!-- gh-comment-id:2571597296 --> @Charles-yueyue831 commented on GitHub (Jan 5, 2025): > pip install matplotlib==3.7.0, It work for me I agree with you
Author
Owner

@cahayamahardika16 commented on GitHub (Jan 9, 2025):

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

<!-- gh-comment-id:2579315551 --> @cahayamahardika16 commented on GitHub (Jan 9, 2025): But you got this error thing was matplotlib this expired. ![Capture 253](https://github.com/user-attachments/assets/82923d10-5205-456b-aaee-bc52fbf3a6d4)
Author
Owner

@meisei4 commented on GitHub (Jan 10, 2025):

I think this might be related? (https://github.com/matplotlib/matplotlib/pull/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

<!-- gh-comment-id:2582183357 --> @meisei4 commented on GitHub (Jan 10, 2025): I think this might be related? (https://github.com/matplotlib/matplotlib/pull/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: ```python ... 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
Author
Owner

@cahayamahardika16 commented on GitHub (Jan 11, 2025):

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

<!-- gh-comment-id:2584974507 --> @cahayamahardika16 commented on GitHub (Jan 11, 2025): I got failure Preprocessing and Feature Extraction "AttributeError: 'NoneType' object has no attribute 'loader'"
Author
Owner

@boycececil666gmailcom commented on GitHub (Jan 22, 2025):

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

<!-- gh-comment-id:2607474130 --> @boycececil666gmailcom commented on GitHub (Jan 22, 2025): I am pretty sure the update of the matplotlib break its support with seaborn
Author
Owner

@ikamensh commented on GitHub (Jan 22, 2025):

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

<!-- gh-comment-id:2608219627 --> @ikamensh commented on GitHub (Jan 22, 2025): someone should report this to matplotlib. I got this error while plotting generic data.
Author
Owner

@FHeizenberg commented on GitHub (Jan 23, 2025):

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

<!-- gh-comment-id:2609688963 --> @FHeizenberg commented on GitHub (Jan 23, 2025): 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](url)
Author
Owner

@alobito commented on GitHub (Feb 2, 2025):

Having the exact same issue. Downgrading matplotlib didn't help, no matter which version I tried.

<!-- gh-comment-id:2629347885 --> @alobito commented on GitHub (Feb 2, 2025): Having the exact same issue. Downgrading matplotlib didn't help, no matter which version I tried.
Author
Owner

@Bartabok commented on GitHub (Feb 27, 2025):

same as alobito. I downgraded matplotlib with
pip install matplotlib==3.7.0
as explained above.... but it solved nothing :/ Got same error message.

<!-- gh-comment-id:2689106301 --> @Bartabok commented on GitHub (Feb 27, 2025): same as alobito. I downgraded matplotlib with pip install matplotlib==3.7.0 as explained above.... but it solved nothing :/ Got same error message.
Author
Owner

@GabrielDornelles commented on GitHub (Mar 10, 2025):

it was removed on matplotlib 3.10. If you want to use downgrade to <3.10

<!-- gh-comment-id:2710654306 --> @GabrielDornelles commented on GitHub (Mar 10, 2025): it was removed on matplotlib 3.10. If you want to use downgrade to <3.10
Author
Owner

@Joseph-Sherman commented on GitHub (Mar 17, 2025):

can you help me? im not familiar with these kind of stuff .. just wanted to use RVC but get AttributeError: 'FigureCanvasAgg' object has no attribute 'tostring_rgb' . I tried and downgraded numpy and matplotlib .. but the issue persists

<!-- gh-comment-id:2727893083 --> @Joseph-Sherman commented on GitHub (Mar 17, 2025): can you help me? im not familiar with these kind of stuff .. just wanted to use RVC but get AttributeError: 'FigureCanvasAgg' object has no attribute 'tostring_rgb' . I tried and downgraded numpy and matplotlib .. but the issue persists
Author
Owner

@Docteur-RS commented on GitHub (Apr 3, 2025):

As of today (03/04/25) doing pip install matplotlib==3.7.0 fixed the error and got to the epoch part.

<!-- gh-comment-id:2776967383 --> @Docteur-RS commented on GitHub (Apr 3, 2025): As of today (03/04/25) doing `pip install matplotlib==3.7.0` fixed the error and got to the epoch part.
Author
Owner

@EscoffierZhou commented on GitHub (Apr 13, 2025):

Python in3.12.0,downgrading to pip install matplotlib==3.9.0works though in 3.7.0 seems still dysfunctional

<!-- gh-comment-id:2799644550 --> @EscoffierZhou commented on GitHub (Apr 13, 2025): Python in`3.12.0`,downgrading to `pip install matplotlib==3.9.0`works though in `3.7.0` seems still dysfunctional
Author
Owner

@RVC-Boss commented on GitHub (Jul 20, 2026):

You can update the code to the latest main branch, where this issue has already been resolved.

<!-- gh-comment-id:5019627777 --> @RVC-Boss commented on GitHub (Jul 20, 2026): You can update the code to the latest `main` branch, where this issue has already been resolved.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
RVC-Project/Retrieval-based-Voice-Conversion-WebUI#1682
No description provided.