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.




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