I am trying to embed a matplotlib canvas into a PySide2 application. I have tried to use this example: https://matplotlib.org/examples/user_interfaces/embedding_in_qt5.html
The example runs fine using PyQt5. However, if I change line 19 from
from PyQt5 import QtCore, QtWidgets
into
from PySide2 import QtCore, QtWidgets
then Python crashes with the message
Fatal Python error: deallocating None
as soon as the application window is closed. Is there any way to get this working properly using PySide2?