I had to build matplotlib and many of its requirements in my home directory because I lack privileges to put stuff in /usr/local. So I build python-2.6.2, freetype-2.3.9, numpy-1.3.0, tcl-8.5.7, tk-8.5.7, and matplotlib-0.98.5.3. Each of those is in its own subdirectory in /home/gam/packages.
Since these packages are not in /usr/local, I had to alter pathways in certain cases in order to get stuff to build, link, and work together.
Things seem close to working, but matplotlib is unable to load a backend (_tkagg). Here’s what happens:
1655: python
Python 2.6.2 (r262:71600, Aug 5 2009, 09:48:28)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
import matplotlib.pyplot
Traceback (most recent call last):
File “”, line 1, in
File “/home/gam/packages/Python-2.6.2/lib/python2.6/site-packages/matplotlib/pyplot.py”, line 75, in
new_figure_manager, draw_if_interactive, show = pylab_setup()
File “/home/gam/packages/Python-2.6.2/lib/python2.6/site-packages/matplotlib/backends/init.py”, line 25, in pylab_setup
globals(),locals(),[backend_name])
File “/home/gam/packages/Python-2.6.2/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py”, line 8, in
import tkagg # Paint image to Tk photo blitter extension
File “/home/gam/packages/Python-2.6.2/lib/python2.6/site-packages/matplotlib/backends/tkagg.py”, line 1, in
import _tkagg
ImportError: libtk8.5.so: cannot open shared object file: No such file or directory
import sys
sys.path
[‘’, ‘/home/gam/packages/Python-2.6.2/lib/python2.6/site-packages’, ‘/home/gam/packages/Python-2.6.2/lib/python26.zip’, ‘/home/gam/packages/Python-2.6.2/lib/python2.6’, ‘/home/gam/packages/Python-2.6.2/lib/python2.6/plat-linux2’, ‘/home/gam/packages/Python-2.6.2/lib/python2.6/lib-tk’, ‘/home/gam/packages/Python-2.6.2/lib/python2.6/lib-old’, ‘/home/gam/packages/Python-2.6.2/lib/python2.6/lib-dynload’, ‘/home/gam/.local/lib/python2.6/site-packages’]
If I understand correctly, _tkagg corresponds to _tkagg.so. Python ought to be able to load that object if it’s in python’s search path. The output above shows the presence of site_packages in sys.path, and that site-packages/matplotlib/backends/backend_tkagg.py does get loaded. _tkagg.so is in the same directory, as shown here:
1654: ls /home/gam/packages/Python-2.6.2/lib/python2.6/site-packages/matplotlib/backends
Matplotlib.nib backend_emf.py backend_gtkcairo.pyc backend_qt4.py backend_tkagg.pyc
init.py backend_emf.pyc backend_macosx.py backend_qt4.pyc backend_wx.py
init.pyc backend_fltkagg.py backend_macosx.pyc backend_qt4agg.py backend_wx.pyc
_backend_agg.so backend_fltkagg.pyc backend_mixed.py backend_qt4agg.pyc backend_wxagg.py
_tkagg.so backend_gdk.py backend_mixed.pyc backend_qtagg.py backend_wxagg.pyc
backend_agg.py backend_gdk.pyc backend_pdf.py backend_qtagg.pyc tkagg.py
backend_agg.pyc backend_gtk.py backend_pdf.pyc backend_svg.py tkagg.pyc
backend_cairo.py backend_gtk.pyc backend_ps.py backend_svg.pyc
backend_cairo.pyc backend_gtkagg.py backend_ps.pyc backend_template.py
backend_cocoaagg.py backend_gtkagg.pyc backend_qt.py backend_template.pyc
backend_cocoaagg.pyc backend_gtkcairo.py backend_qt.pyc backend_tkagg.py
I have tried clean rebuilds and reinstalls from the ground up but end with the same result.
Help!
Thanks.
Here’s information about my system and build:
1626: uname -a
Linux ccscs4.lanl.gov 2.6.9-67.0.7.ELsmp #1 SMP Wed Feb 27 04:48:20 EST 2008 i686 i686 i386 GNU/Linux
matplotlib version: 0.98.5.3
1630: diff setup.cfg setup.cfg.template
60c60
< #tkagg = True
···
#tkagg = False
76d75
< #backend = TkAgg
1631: diff setupext.py setupext.py.orig
50,51c50,51
< ‘linux2’ : [‘/usr/local’, ‘/usr’, ‘/home/gam/packages’],
< ‘linux’ : [‘/usr/local’, ‘/usr’, ‘/home/gam/packages’],
'linux2' : ['/usr/local', '/usr'],
'linux' : ['/usr/local', '/usr',],
950,959c950,953
< #gam
< tcl_inc = “/home/gam/packages/tcl8.5.7/include”
< tcl_lib = “/home/gam/packages/tcl8.5.7/lib”
< tk_inc = “/home/gam/packages/tcl8.5.7/include”
< tk_lib = “/home/gam/packages/tcl8.5.7/lib”
< #tcl_inc = “/usr/local/include”
< #tk_inc = “/usr/local/include”
< #tcl_lib = “/usr/local/lib”
< #tk_lib = “/usr/local/lib”
< #mag
tcl_inc = "/usr/local/include"
tk_inc = "/usr/local/include"
tcl_lib = "/usr/local/lib"
tk_lib = "/usr/local/lib"
1063,1065d1056
< #gam
< tk_ver = tcl_ver = ‘8.5’
< #mag
1633: python setup.py build
============================================================================
BUILDING MATPLOTLIB
matplotlib: 0.98.5.3
python: 2.6.2 (r262:71600, Aug 5 2009, 09:48:28) [GCC
3.4.6 20060404 (Red Hat 3.4.6-11)]
platform: linux2
REQUIRED DEPENDENCIES
numpy: 1.3.0
freetype2: 9.7.3
OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.7
Tkinter: Tkinter: 70220, Tk: 8.5, Tcl: 8.5
* Guessing the library and include directories for
* Tcl and Tk because the tclConfig.sh and
* tkConfig.sh could not be found and/or parsed.
wxPython: no
* wxPython not found
Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to "import gtk" in your build/install environment
Mac OS X native: no
Qt: no
Qt4: no
Cairo: no
OPTIONAL DATE/TIMEZONE DEPENDENCIES
datetime: present, version unknown
dateutil: matplotlib will provide
pytz: 2008c
OPTIONAL USETEX DEPENDENCIES
dvipng: no
ghostscript: 7.07
latex: 3.14159
pdftops: 3.00
1634: gcc --version
gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-11)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
==========================
Graham Mark
CCS-3
Information Sciences
Los Alamos National Laboratory
505-667-8147