Anaconda: Unable to import pylab
Just had this problem and it was related to which qt backend matplotlib was trying to use, try:
import PyQt4
If you don't have PyQt4 you probably have PySide
import PySide
If this is the case you need to set the matplotlib.rcParams['backend.qt4'] == 'PySide'
not 'PyQt4'
. You can also do this in your matplotlibrc file (~/.matplotlib/matplotlibrc)
# find and change line:
backend.qt4 : PySide
Note: if you don't have the matplotlibrc file you can copy it from the matplotlib source directory
import os
import matplotlib
mpl_dir = os.path.dirname(matplotlib.__file__)
os.system("cp {}/mpl-data/matplotlibrc ~/.matplotlib/".format(mpl_dir))