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.
I don’t recommend this fix anymore as it’s for old Python version ≤ 3.5.
python -m pip install pyside
This will take several minutes and may require the prerequisites:
apt install libxext-dev python-qt4 qt4-dev-tools build-essential