I installed python 2.7 and matplotlib 1.1.1 on Mountain Lion via Macports and when I run the following:
import matplotlib
matplotlib.use('GTKAgg')
import matplotlib.pyplot as plt
on the last line I get the error messages below. After looking around on the internet the only "solution" I've seen is to use 'Agg' as the backend instead of 'GTKAgg', but when I do this it runs (and terminates without any errors) but nothing plots. The lines above work fine on my Windows XP. Anyone have any suggestions?
Error message:
line 2, in import matplotlib.pyplot as plt
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pyplot.py", line 95, in new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/init.py", line 25, in pylab_setup globals(),locals(),[backend_name])
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 52, in cursors.MOVE : gdk.Cursor(gdk.FLEUR), RuntimeError: could not create GdkCursor object
plt.show()
? – Brian CainMacOSX
orCocoaAgg
backends? – unutbuimport matplotlib.rcsetup as rc; print(rc.all_backends)
. It wouldn't hurt to try thim all. – unutbuVersions/2.6
. Make sure matplotlib was installed to use Python2.7, and make sure the python used to call the script is Python2.7. – unutbu