ImportError: Gtk* Backend Requires pygtk to Be Installed¶
If you see a message similar to this:
Traceback (most recent call last):
File "", line 1, in
File "./zipdir/NanoLanguage.py", line 83, in
File "./zipdir/NL/Calculators/HuckelCalculator/DeviceHuckelCalculator.py", line 75, in
File "./zipdir/NL/Analysis/ProjectedLocalDensityOfStates.py", line 2, in
File "./build/lib/python2.7/site-packages/pylab.py", line 1, in
File "./build/lib/python2.7/site-packages/matplotlib/pylab.py", line 265, in
File "./build/lib/python2.7/site-packages/matplotlib/pyplot.py", line 97, in
File "./build/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
File "./build/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py", line 16, in
ImportError: Gtk* backend requires pygtk to be installed.
then check the file $HOME/.matplotlib/matplotlibrc. If it contains the line
backend : GTK
then change this to
backend : TkAgg
and hopefully the problem is fixed. Read more about matplotlib customization here.