I installed matplotlib successfully inside a virtualenv. Now I'm trying to get it to draw. I know how to change the backend, but I'm having a whole lot of trouble figuring out what to change it to.
Has anyone managed to get it totally working with python3? If yes, how?
I have tried a bunch of things. I have cycled through all the backends to see what all of the complaints are, not I'm trying to get just one of them to work.
Also possibly worth noting is that my goal is to integrate it into a Pyramid app.
Here's what has happened so far for all the different backends:
- Agg: this was the default backend. it does not draw
- GTK: requires pygtk which apparently has not been ported to python3
- GTKAgg: ditto
- GTKCairo: says 'required package gtk' assume something along the lines of above
- FltkAgg: Doesn't look like it has a python3 version. Even though it is mentioned in the python3 UI FAQ. I guess that was just a rouse. gosh darnit
- MacOSX: I'm running ubuntu. assumed inappropriate
- QtAgg: requires pyqt. see Qt4Agg
- Qt4Agg: see Installing PyQt4 in a virtualenv
- TkAgg: ImportError: cannot import name _tkagg. I can run import tkinter in the interpreter though, so I'm not really sure what's broken as yet
- WX: ImportError: Matplotlib backend_wx and backend_wxagg require wxversion, which was not found
- WXAgg: ditto
- CocoaAgg: ImportError: The CococaAgg backend required PyObjC to be installed!
- GTK3Cairo : ImportError: GTK3 backend requires pygobject to be installed. I tried installing it but when I try to configure it with the correct python it complains about missing headers
- GTK3Agg: no module named cairo. but I assue I'll hit the same issue as above
- cairo: Cairo backend requires that pycairo is installed
- emf:You must first install pyemf from http://pyemf.sf.net. Looks like it is supposed to do windowsey stuff so this may not be a good choice
- gdk: no module called gobject
- pdf: runs but doesn't draw
- pgf: ditto
- ps: ditto
- svg: ditto
- template: ditto .
The script I am using to test my backend is:
import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.show()
So far I have spent waaay too much time trying to get python3.2 and qt4 playing nice, and I just seem to be running into problems every way I turn. So instead of continuing with my trial and error approach I want to ask:
- What is the best option for Python3.2 and Pyramid?
- How do I make it happen?
In the meantime I will continue with the trial-and-error thing and update my question as I go.
NOTES on stuff I'm trying
For TkAgg:
since tkinter imports correctly I'm assuming it's installed correctly (if I'm wrong I suppose there's a way to test it?). This guy http://ask.sagemath.org/question/626/sage-python-import-matplotlib-no-module-named had a similar problem but Im sure his setup is different from mine. The solution was to find tkagg.py in the bowels of the python3.2 site packages directory and edit the offending import statement. I find it hard to believe that matplotlib ships broken (and I cant run the modified code suggested...)
For WX stuff:
wxPython for Python 3 says there is no support for python3 yet. Also wxPython has no mention of python3 on their site so I guess that's a no-go. running out of options :/
Cocoa:
Ditto: Writing Cocoa applications in Python 3
EMF:
ditto: http://pyemf.sourceforge.net/README.html
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…