Skip to content

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

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

Closed
hjcxlp opened this issue Jan 22, 2025 · 2 comments · May be fixed by #2068
Closed

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

hjcxlp opened this issue Jan 22, 2025 · 2 comments · May be fixed by #2068

Comments

@hjcxlp
Copy link

hjcxlp commented Jan 22, 2025

Traceback (most recent call last):
File "D:\GPT-SoVITS\GPT_SoVITS\s2_train.py", line 601, in
main()
File "D:\GPT-SoVITS\GPT_SoVITS\s2_train.py", line 57, in main
mp.spawn(
File "D:\GPT-SoVITS\venv\Lib\site-packages\torch\multiprocessing\spawn.py", line 241, in spawn
return start_processes(fn, args, nprocs, join, daemon, start_method="spawn")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\GPT-SoVITS\venv\Lib\site-packages\torch\multiprocessing\spawn.py", line 197, in start_processes
while not context.join():
^^^^^^^^^^^^^^
File "D:\GPT-SoVITS\venv\Lib\site-packages\torch\multiprocessing\spawn.py", line 158, in join
raise ProcessRaisedException(msg, error_index, failed_process.pid)
torch.multiprocessing.spawn.ProcessRaisedException:

-- Process 0 terminated with the following error:
Traceback (most recent call last):
File "D:\GPT-SoVITS\venv\Lib\site-packages\torch\multiprocessing\spawn.py", line 68, in _wrap
fn(i, *args)
File "D:\GPT-SoVITS\GPT_SoVITS\s2_train.py", line 255, in run
train_and_evaluate(
File "D:\GPT-SoVITS\GPT_SoVITS\s2_train.py", line 430, in train_and_evaluate
"slice/mel_org": utils.plot_spectrogram_to_numpy(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\GPT-SoVITS\GPT_SoVITS\utils.py", line 145, in plot_spectrogram_to_numpy
data = np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep="")
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FigureCanvasAgg' object has no attribute 'tostring_rgb'

@hjcxlp hjcxlp changed the title pls help to solve this issue AttributeError: 'FigureCanvasAgg' object has no attribute 'tostring_rgb' Jan 22, 2025
@hjcxlp hjcxlp closed this as completed Jan 22, 2025
@Zhmz
Copy link

Zhmz commented Jan 23, 2025

hello, Has it been solved? i have this problem too.

@pad918
Copy link

pad918 commented Feb 9, 2025

Matplotlib version 3.10 removed the function "tostring_rgb" (see here https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.10.0.html). Try downgrading to version 3.9

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

Successfully merging a pull request may close this issue.

3 participants