Works for me (Ubuntu 9.10).
Might depend on precisely what you're trying to do. Try this:
import pylab as P
P.figure()
P.show()
just to see if you get a blank plot window. If you do, all should be ok, actually.
First two command give no errors, the output of the second is <maptplotlin.figure.Figure object as 0x1612510>
However after executing the P.show() command I get the following error:
/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/backends/__init__.py:41: UserWarning:
Your currently selected backend, 'agg' does not support show().
Please select a GUI backend in your matplotlibrc file ('/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/mpl-data/matplotlibrc')
or with matplotlib.use()
If I now try another backend, for instance Qt4Agg I get the error that Qt4 libraries should be installed. They are installed for my local Python distribution, but VNL seems to use its own.
Yes, ATK uses its own Qt, you cannot (and must not) use some other Qt with ATK.
agg is really just for piping the output to a file, so it will not work with show() (although it shouldn't give error messages, just not do anything).
The backend to use for show() is TkAgg. On my Ubuntu that seems to work as default, but perhaps you can try
import matplotlib as mpl
mpl.use('TkAgg')
import pylab as P
P.figure()
P.show()
If it doesn't work, please post the exact error message.
ATK comes with all backends provided, so it's not a matter that they are missing; check the contents of atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/backend. However, most of them require additional packages, so only TkAgg and Agg (and pdf, ps, svg and other file format exports) are enabled out of the box.
Make sure you haven't modified any files in the installation tree. Also, there might be some conflict with environment variables...
It now gives an error after the import pylab command:
>>> import matplotlib as mpl
>>> mpl.use('TkAgg')
>>> import pylab as P
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "./build/nlpython/lib/python2.6/site-packages/pylab.py", line 1, in <module>
File "./build/nlpython/lib/python2.6/site-packages/matplotlib/pylab.py", line 247, in <module>
File "./build/nlpython/lib/python2.6/site-packages/matplotlib/pyplot.py", line 78, in <module>
File "./build/nlpython/lib/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
File "./build/nlpython/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 7, in <module>
File "./build/nlpython/lib/python2.6/lib-tk/Tkinter.py", line 39, in <module>
ImportError: No module named _tkinter
It is the 11.1 package.
The locate command returns this:
/home/sten/bin/VNL/vnl-2008.10.0/atk/lib/python2.4/lib-dynload/_tkinter.so
/windows/C/Program Files/Corel/Corel Paint Shop Pro X/Python Libraries/DLLs/_tkinter.pyd
/windows/C/Program Files/Scribus 1.3.3.13/dlls/_tkinter.pyd
I checked the tarball to check if I didn't delete the file accidentally and couldn't find the file _tkinter.so in it.
I did this in the 32 bit version (as the 64 bit is missing a file). Install was successful, however, apparently the 32 bit and 64 bit versions of some shared libs were mixed up. Now I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/pylab.py", line 206, in <module>
from matplotlib import mpl # pulls in most modules
File "/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/mpl.py", line 1, in <module>
from matplotlib import artist
File "/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/artist.py", line 5, in <module>
from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
File "/home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/transforms.py", line 34, in <module>
from matplotlib._path import affine_transform
ImportError: /home/sten/bin/VNL/atk-2009.11/nlpython/lib/python2.6/site-packages/matplotlib/_path.so: wrong ELF class: ELFCLASS64
Ok I removed all instances of ATK I had and reinstalled the 32 bit version. I also deleted the matplotlib build directory. Aagain I get the error that
libtk8.4.so.0. so I try to install matplotlib again from a clean source dir. When I now run nlpython setup.py build I get the following error:
/home/sten/bin/VNL/atk-2009.11/nlpython/include/python2.6/pyport.h:685:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
In file included from /usr/include/c++/4.4/ext/hash_map:59,
from ./CXX/Extensions.hxx:68,
from src/ft2font.h:4,
from src/ft2font.cpp:1:
I checked and I have the available 32 bit versions installed for the matplotlib required packages. I also have the 32 bit version of the gcc and glibc compiler.