matplotlib import pylab problem (/usr/lib/libgdk-x11-2.0.so.0: undefined symbol: cairo_xlib_surface_create_for_bitmap)

Hi,

I have matplotlib installed and it runs properly. However, I also want
to use pysqlite, and it seems that the only way to use pysqlite on my
system is to first set LD_LIBRARY_PATH to /usr/loca/lib. But if I do
this, then I am no longer able to make matplotlib work. Here is the
traceback:

export LD\_LIBRARY\_PATH=/usr/local/lib python
Python 2.4.3 (#2, Oct 6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import pylab

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/pylab.py", line 1, in ?
    from matplotlib.pylab import *
  File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 199, in ?
    import backends
  File "/usr/lib/python2.4/site-packages/matplotlib/backends/__init__.py",
line 19, in ?
    globals(),locals(),[backend_name])
  File "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py",
line 11, in ?
    from backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
  File "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py",
line 21, in ?
    from backend_gdk import RendererGDK
  File "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gdk.py",
line 31, in ?
    import gtk, pango
  File "/usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line 45, in ?
    from _gtk import *
ImportError: /usr/lib/libgdk-x11-2.0.so.0: undefined symbol:
cairo_xlib_surface_create_for_bitmap

Why is the system having trouble finding the cairo library. Shouldn't
it just look in /usr/local/lib first (as specified by LD_LIBRARY_PATH)
and then move onto the other directories it looks for where it finds
all the files it was finding when LD_LIBRARY_PATH was unset? Does this
mean that I maybe have some other versions of pylab's dependencies
installed in /usr/local/lib which get loaded up first and cause the
problem? If so, then how can I check that is the case, and how can I
remove them.

Any help would be greatly apprecaited.

Thanks,
Ali.

Ok, the problem is solved now. It seems that the problem was indeed
that I had different versions of python's dependencies (libcairo and
libpango) in the /usr/local/lib directory. Deleting those files from
there solves the problem.

Thanks,
Ali.

ยทยทยท

On 5/17/07, Muhammad Ali <talk2ali@...287...> wrote:

Hi,

I have matplotlib installed and it runs properly. However, I also want
to use pysqlite, and it seems that the only way to use pysqlite on my
system is to first set LD_LIBRARY_PATH to /usr/loca/lib. But if I do
this, then I am no longer able to make matplotlib work. Here is the
traceback:

export LD\_LIBRARY\_PATH=/usr/local/lib python
Python 2.4.3 (#2, Oct 6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/pylab.py", line 1, in ?
    from matplotlib.pylab import *
  File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 199, in ?
    import backends
  File "/usr/lib/python2.4/site-packages/matplotlib/backends/__init__.py",
line 19, in ?
    globals(),locals(),[backend_name])
  File "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py",
line 11, in ?
    from backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
  File "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py",
line 21, in ?
    from backend_gdk import RendererGDK
  File "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gdk.py",
line 31, in ?
    import gtk, pango
  File "/usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line 45, in ?
    from _gtk import *
ImportError: /usr/lib/libgdk-x11-2.0.so.0: undefined symbol:
cairo_xlib_surface_create_for_bitmap

Why is the system having trouble finding the cairo library. Shouldn't
it just look in /usr/local/lib first (as specified by LD_LIBRARY_PATH)
and then move onto the other directories it looks for where it finds
all the files it was finding when LD_LIBRARY_PATH was unset? Does this
mean that I maybe have some other versions of pylab's dependencies
installed in /usr/local/lib which get loaded up first and cause the
problem? If so, then how can I check that is the case, and how can I
remove them.

Any help would be greatly apprecaited.

Thanks,
Ali.