Problem with pyplot under Linux Ubuntu Intrepid

Dear ALL,

I just found the following error when trying to run a very simple test
MPL/Basemap script under Ubuntu Linux Intrepid. This does *not* happen
when not importing MPL pyplot (for example, in a wxPython embedded
app).

Traceback (most recent call last):
  File "/home/maurobio/Projetos/Croizat/test/mexico.py", line 2, in <module>
    import matplotlib.pyplot as plt
  File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/pyplot.py",
line 75, in <module>
    new_figure_manager, draw_if_interactive, show = pylab_setup()
  File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/__init__.py",
line 25, in pylab_setup
    globals(),locals(),[backend_name])
  File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/backend_gtkagg.py",
line 10, in <module>
    from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
FigureCanvasGTK,\
  File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/backend_gtk.py",
line 25, in <module>
    from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
  File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/backend_gdk.py",
line 29, in <module>
    from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
ImportError: libffi.so.4: cannot open shared object file: No such file
or directory

Any hints??? I am near panic now...

Thanks in advance!

···

--
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...287...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."

No need to panic. It looks like your default backend has been set to gtkagg. I think you just need to set your backend to wxagg in your matplotlibrc file: http://matplotlib.sourceforge.net/users/customizing.html

P.S. pyplot should not be used in an embedded environment, that interface is meant for command line and scripting use. For embedded applications, you should use the object-oriented interface. There are several wx examples at http://matplotlib.sourceforge.net/examples/user_interfaces/index.html

···

On Mon, Jan 12, 2009 at 8:44 AM, Mauro Cavalcanti <maurobio@…287…> wrote:

Dear ALL,

I just found the following error when trying to run a very simple test

MPL/Basemap script under Ubuntu Linux Intrepid. This does not happen

when not importing MPL pyplot (for example, in a wxPython embedded

app).

Traceback (most recent call last):

File “/home/maurobio/Projetos/Croizat/test/mexico.py”, line 2, in

import matplotlib.pyplot as plt

File “/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/pyplot.py”,

line 75, in

new_figure_manager, draw_if_interactive, show = pylab_setup()

File “/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/init.py”,

line 25, in pylab_setup

globals(),locals(),[backend_name])

File “/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/backend_gtkagg.py”,

line 10, in

from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,

FigureCanvasGTK,\

File “/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/backend_gtk.py”,

line 25, in

from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK

File “/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/backend_gdk.py”,

line 29, in

from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array

ImportError: libffi.so.4: cannot open shared object file: No such file

or directory

Any hints??? I am near panic now…

No one ever made a dime by panicking :slight_smile:

Did you compile mpl yourself or are you using a prepackaged version?
If you are using the ubuntu package of mpl, this is likely a bug with
the package and should be reported to ubuntu. If you compiled
yourself, what version are you using? Can you attach the output of a
clean build process?

See::

  http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#reporting-problems

Note that the problem appears in the gtk backend, so if it turns out
to be an ubuntu problem and you need a solution right away, you should
be able to use a different backend, eg tkagg, but please take the time
to report it to the ubuntu package maintainer if it has not been
already. It looks like it is related to this debian bug

  http://osdir.com/ml/linux.debian.devel.python.modules/2008-05/msg00009.html

I've CCd Sandro (the debian, not the ubuntu, maintainter) who may have
more information.

JDH

···

On Mon, Jan 12, 2009 at 7:44 AM, Mauro Cavalcanti <maurobio@...287...> wrote:

Dear ALL,

I just found the following error when trying to run a very simple test
MPL/Basemap script under Ubuntu Linux Intrepid. This does *not* happen
when not importing MPL pyplot (for example, in a wxPython embedded
app).

Traceback (most recent call last):
   from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
FigureCanvasGTK,\
File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/backend_gtk.py",
line 25, in <module>
   from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/backend_gdk.py",
line 29, in <module>
   from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
ImportError: libffi.so.4: cannot open shared object file: No such file
or directory

Any hints??? I am near panic now...

Dear John & Darren,

Thanks for your reply -- the "panic" I alluded for is simply the
result of three months' strain working day-by-day to develop a very
large application using wxPython/MPL/Basemap under Linux, along with a
RAM crash and, more recently, an upgrade form Ubuntu 8.04 (Hardy
Heron) to Ubuntu 8.10 (Intrepid Ibex -- I love the fondness the guys
at Canonical have for zoology).

Well, that said, here are my reply to the questions and comments:

1) I am not using pyplot in an embedded environment. Indeed,
MPL/Basemap is running very well embedded in my wxPython application,
*without* pyplot of course. The reported error appears only when I try
any test script using pyplot (these scripts are useful for testing
ideas in an interpreted language as Python, before putting them to
work in a GUI application). My application uses the wxagg backends,
which are work well.

2) All scripts using pyplot ran quite well under Ubuntu Hardy; they
are just presenting these issues after I upgraded to Intrepid (which,
BTW, looks much more stable in my system than was Hardy -- except for
this problem with MPL)

3) I am running MPL 0.98.5.1, installed with Ubuntu itself. I ran sudo
easy_install matplotlib in an attempt to install version 0.98.5.2, but
this gave no result (easy_Install tells me that I already have the
latest version of MPL)

Well, I have googled the error message: "ImportError: libffi.so.4:
cannot open shared object file: No such file or directory" and it
seems that a few other Python applications are crashing with this
error under Ubuntu Intrepid (but I could not find any solution, just
error reports).

I am not sure if compiling from source would help in this case,
because the error seems to be related to a missing system (?) library
and not to MPL or any of the backends.

So, for the time being, it looks that I cannot use MPL with pyplot
anymore, which is not entirely a huge problem (as I do not use the
library in MATLAB-style anyway) , but prevents me to use it to fast
testing of Basemap scripts.

With best regards,

2009/1/12 John Hunter <jdh2358@...287...>:

···

On Mon, Jan 12, 2009 at 7:44 AM, Mauro Cavalcanti <maurobio@...287...> wrote:

Dear ALL,

I just found the following error when trying to run a very simple test
MPL/Basemap script under Ubuntu Linux Intrepid. This does *not* happen
when not importing MPL pyplot (for example, in a wxPython embedded
app).

Traceback (most recent call last):
   from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
FigureCanvasGTK,\
File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/backend_gtk.py",
line 25, in <module>
   from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-i686.egg/matplotlib/backends/backend_gdk.py",
line 29, in <module>
   from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
ImportError: libffi.so.4: cannot open shared object file: No such file
or directory

Any hints??? I am near panic now...

No one ever made a dime by panicking :slight_smile:

Did you compile mpl yourself or are you using a prepackaged version?
If you are using the ubuntu package of mpl, this is likely a bug with
the package and should be reported to ubuntu. If you compiled
yourself, what version are you using? Can you attach the output of a
clean build process?

See::

http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#reporting-problems

Note that the problem appears in the gtk backend, so if it turns out
to be an ubuntu problem and you need a solution right away, you should
be able to use a different backend, eg tkagg, but please take the time
to report it to the ubuntu package maintainer if it has not been
already. It looks like it is related to this debian bug

http://osdir.com/ml/linux.debian.devel.python.modules/2008-05/msg00009.html

I've CCd Sandro (the debian, not the ubuntu, maintainter) who may have
more information.

JDH

--
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...287...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."

Hello Mauro,
(thanks John to highlight me:) )

3) I am running MPL 0.98.5.1, installed with Ubuntu itself. I ran sudo
easy_install matplotlib in an attempt to install version 0.98.5.2, but
this gave no result (easy_Install tells me that I already have the
latest version of MPL)

I'm the Debian maint (while working with Ubuntu one) so I suggest to
use the code in our SVN repository to build the package:

<get the mpl tarball, v0.98.5.2 should be fine, name it
matplotlib_0.98.5.2.orig.tar.gz>
<untar it in a dir called matplotlib-0.98.5.2, that will contain the mpl files>
cd matplotlib-0.98.5.2
svn co svn://svn.debian.org/svn/python-modules/packages/matplotlib/trunk/debian/
sudo apt-get install build-essential
debuild -us -uc
<install the missing build-dependencies returned from above commands
and reiter if needed>

It's a little bit tedious (and the build will take a while) but in ..
you should find the .deb to install.

If "someone" would release .3, we could package it for Debian systems :slight_smile: :slight_smile:

Well, I have googled the error message: "ImportError: libffi.so.4:
cannot open shared object file: No such file or directory" and it
seems that a few other Python applications are crashing with this
error under Ubuntu Intrepid (but I could not find any solution, just
error reports).

libffi received a SONAME bump to .5 (infact, now the package is called
libffi5), so there might be something still referring the old library,
that probably went removed during upgrade (Ubuntu QA work.....)

I am not sure if compiling from source would help in this case,
because the error seems to be related to a missing system (?) library
and not to MPL or any of the backends.

yes, it would help. because relinking to new lib will fix those broken links.

Let us know any progress.

Regards,

···

On Mon, Jan 12, 2009 at 17:50, Mauro Cavalcanti <maurobio@...287...> wrote:
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

Dear Sandro,

I must say I feel truly honoured. I never expected my humble complaint
would merit the attention of one of the Debian maintainters!

Well, thank you very much!

I will follow the directions you provided - as I understood, they will
result in the creation of a deb package for the latest version of
Matplotlib? This will be great!

I will report the results to you (and the Matplotlib-users lists) as
soon as possible.

With warmest regards,

2009/1/12 Sandro Tosi <morph@...10...>:

···

Hello Mauro,
(thanks John to highlight me:) )

On Mon, Jan 12, 2009 at 17:50, Mauro Cavalcanti <maurobio@...287...> wrote:

3) I am running MPL 0.98.5.1, installed with Ubuntu itself. I ran sudo
easy_install matplotlib in an attempt to install version 0.98.5.2, but
this gave no result (easy_Install tells me that I already have the
latest version of MPL)

I'm the Debian maint (while working with Ubuntu one) so I suggest to
use the code in our SVN repository to build the package:

<get the mpl tarball, v0.98.5.2 should be fine, name it
matplotlib_0.98.5.2.orig.tar.gz>
<untar it in a dir called matplotlib-0.98.5.2, that will contain the mpl files>
cd matplotlib-0.98.5.2
svn co svn://svn.debian.org/svn/python-modules/packages/matplotlib/trunk/debian/
sudo apt-get install build-essential
debuild -us -uc
<install the missing build-dependencies returned from above commands
and reiter if needed>

It's a little bit tedious (and the build will take a while) but in ..
you should find the .deb to install.

If "someone" would release .3, we could package it for Debian systems :slight_smile: :slight_smile:

Well, I have googled the error message: "ImportError: libffi.so.4:
cannot open shared object file: No such file or directory" and it
seems that a few other Python applications are crashing with this
error under Ubuntu Intrepid (but I could not find any solution, just
error reports).

libffi received a SONAME bump to .5 (infact, now the package is called
libffi5), so there might be something still referring the old library,
that probably went removed during upgrade (Ubuntu QA work.....)

I am not sure if compiling from source would help in this case,
because the error seems to be related to a missing system (?) library
and not to MPL or any of the backends.

yes, it would help. because relinking to new lib will fix those broken links.

Let us know any progress.

Regards,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

--
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...287...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."

I must say I feel truly honoured. I never expected my humble complaint
would merit the attention of one of the Debian maintainters!

eheh, well, we are not some sort of gods or what: we talk to mortals now :smiley:

I will follow the directions you provided - as I understood, they will
result in the creation of a deb package for the latest version of
Matplotlib? This will be great!

Yes: Ubuntu is a Debian-based distribution, so once you'll have the
deb files (built on your ubuntu box) it enough to

sudo dpkg -i python-matplotlib*.deb

and it will install them

I will report the results to you (and the Matplotlib-users lists) as
soon as possible.

Great. The only problem I see is that there are a lot of caveats in
building packages, and you can face some corner case (I couldn't cope
in my uber-fast introduction to deb building :slight_smile: ).

Regards,

···

On Mon, Jan 12, 2009 at 19:52, Mauro Cavalcanti <maurobio@...287...> wrote:
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

Dear Sandro,

First of all, I apologize for the delay in replying -- yesterday was
already late night here and I also had to fight (???) a "kernel panic"
in my Linux box the cause of which is not yet clear (I also had it
under Ubuntu Hardy and now it appeared in Intrepid -- under Hardy, I
substituted my only RAM chip and the problem disappeared, but now I
think the problem may be related to overheating -- it is the hottest
tropical summer here down under!).

Well, after following the steps you provided for creating the Debian
package for MPL, and installing all required dependencies, I still
could not create the package -- the reason is that the program keeps
complaining about an older version of python-sphinx, even if I
upgraded to the latest version it using easy_install... Maybe I will
have to build sphinx from souce too?

With best regards,

2009/1/12 Sandro Tosi <morph@...10...>:

···

On Mon, Jan 12, 2009 at 19:52, Mauro Cavalcanti <maurobio@...287...> wrote:

I must say I feel truly honoured. I never expected my humble complaint
would merit the attention of one of the Debian maintainters!

eheh, well, we are not some sort of gods or what: we talk to mortals now :smiley:

I will follow the directions you provided - as I understood, they will
result in the creation of a deb package for the latest version of
Matplotlib? This will be great!

Yes: Ubuntu is a Debian-based distribution, so once you'll have the
deb files (built on your ubuntu box) it enough to

sudo dpkg -i python-matplotlib*.deb

and it will install them

I will report the results to you (and the Matplotlib-users lists) as
soon as possible.

Great. The only problem I see is that there are a lot of caveats in
building packages, and you can face some corner case (I couldn't cope
in my uber-fast introduction to deb building :slight_smile: ).

Regards,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

--
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...287...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."

Well, honestly I don't know and I don't want to invest too much time
on this: I'll provide the compiled packages (even if still temporary,
waiting for Matplotlib developers to release 0.98.5.3) tomorrow, and
then I'll post the location on the list. They will be for Debian Sid,
so they might not work "out of the box" and you might need to get
other packages from Debian and install into Ubuntu.

Regards,

···

On Tue, Jan 13, 2009 at 13:20, Mauro Cavalcanti <maurobio@...287...> wrote:

Dear Sandro,

First of all, I apologize for the delay in replying -- yesterday was
already late night here and I also had to fight (???) a "kernel panic"
in my Linux box the cause of which is not yet clear (I also had it
under Ubuntu Hardy and now it appeared in Intrepid -- under Hardy, I
substituted my only RAM chip and the problem disappeared, but now I
think the problem may be related to overheating -- it is the hottest
tropical summer here down under!).

Well, after following the steps you provided for creating the Debian
package for MPL, and installing all required dependencies, I still
could not create the package -- the reason is that the program keeps
complaining about an older version of python-sphinx, even if I
upgraded to the latest version it using easy_install... Maybe I will
have to build sphinx from souce too?

--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

Dear Sandro,

After sending you the previous message, I just decided to try one
little thing: I used "easy_install -U matplotlib" and then the latest
version (0.98.5.2) was correctly retrieved from the SF repository and
properly installed (before followed the instructions you provided
yesterday, this procedure did not result). And then I now have MPL
completely working again on my Ubuntu Intrepid box!

Thank you very much for your attention.

With best regards,

2009/1/13 Sandro Tosi <morph@...10...>:

···

Well, honestly I don't know and I don't want to invest too much time
on this: I'll provide the compiled packages (even if still temporary,
waiting for Matplotlib developers to release 0.98.5.3) tomorrow, and
then I'll post the location on the list. They will be for Debian Sid,
so they might not work "out of the box" and you might need to get
other packages from Debian and install into Ubuntu.

Regards,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

--
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...287...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."