PySide in Anaconda3

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:

  1. install QT 5: conda install pyqt
  2. add to matplotlibrc the line
   backend: qt5agg

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