Normally one should be using Matplotlib ≥ 3.x to avoid issues as below, since they added better backend autodetection in modern Matplotlib. Older Matplotlib installs that used QT4Agg may give error message
ImportError: No module named ‘PySide’
While the best fix is to update your Python install to use current versions of Matplotlib and associated libraries, if that is not feasible, a manual workaround follows:
- install QT 5:
conda install pyqt
add to matplotlibrc the line
Note that one should generally not be using PySide anymore.
Do not use this fix anymore as it’s for obsolete Python versions.
python -m pip install pyside
This may require the prerequisites:
apt install libxext-dev python-qt4 qt4-dev-tools build-essential