Unable to run wxPython 3.0.x on Ubuntu (e.g. using wx as matplotlib backend)

tl;dr -- Solution: Uninstall the package "glib".

Symptom: After updating wxPython to v3.0+ (possibly after updating matplotlib to v1.5+, of which wxPython 3.0+ is a dependency), you are unable to import wxPython. This may occur when attempting to set matplotlib's backend to Wx or WxAgg upon which an error message will be returned resembling this:

ImportError: Matplotlib backend_wx and backend_wxagg require wxPython >=2.8.12

Cause: wxPython on Linux requires specific libraries that vary between Linux distributions. We have included such libraries as separate packages that are dependencies of wxPython. However, on some versions of Ubuntu (at least v14.04+, but there may be others) wxPython requires the system libraries, which are blocked by these packages.

Fix:  To date, all that is required is uninstalling the package "glib", either in the package manager or by running enpkg glib --remove at the command line. After this wxPython should import and can be set as the backend in matplotlib.

Have more questions? Submit a request

Comments

Powered by Zendesk