It appears to be importing _tkagg.so just fine, but it depends on Tcl/Tk
itself, notably libtk8.5.so, which it can not find.
You can see what _tkagg.so depends on with ldd, eg.:
> ldd ~/usr/lib/python2.5/site-packages/matplotlib/backends/_tkagg.so
libtk8.4.so => /usr/lib/libtk8.4.so (0x006c6000)
libtcl8.4.so => /usr/lib/libtcl8.4.so (0x002ce000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x005b9000)
libfreetype.so.6 => /home/mdroe/usr/lib/libfreetype.so.6
(0x00c92000)
libz.so.1 => /usr/lib/libz.so.1 (0x00111000)
libm.so.6 => /lib/tls/libm.so.6 (0x00a15000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0046b000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00121000)
libc.so.6 => /lib/tls/libc.so.6 (0x00133000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x00a7d000)
libdl.so.2 => /lib/libdl.so.2 (0x00281000)
/lib/ld-linux.so.2 (0x00bd1000)
You may need to add the path to your libtk8.5.so to your LD_LIBRARY_PATH
(since you mention you built it yourself and put it in a custom
location) and then run ldconfig to get the dynamic linker to find it.
Cheers,
Mike
Graham Mark wrote:
>
> 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 "<stdin>", line 1, in <module>
> File
> "/home/gam/packages/Python-2.6.2/lib/python2.6/site-packages/matplotlib/pyplot.py",
>
> line 75, in <module>
> 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 <module>
> 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 <module>
> 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
>
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users