CVS ?

I have a serious problem with my Linux installation of matplotlib. It segfaults after a very brief display of a plot window outline (no actual plot within it). Before presenting the details of my problem, I would like to download the latest CVS version to make sure this hasn't been fixed already, however I cannot find any references to CVS in any of the Matplotlib web pages, except for a reference for it in one of the recent emails in this list. How do I find it ?

Thanks in advance,

Wayne

Wayne E. Harlan wrote:

I have a serious problem with my Linux installation of matplotlib. It segfaults after a very brief display of a plot window outline (no actual plot within it). Before presenting the details of my problem, I would

If a straightforward plotting sequence, such as one of the examples, does this, then it sounds like a broken installation, not a matplotlib bug.

like to download the latest CVS version to make sure this hasn't been fixed already, however I cannot find any references to CVS in any of the Matplotlib web pages, except for a reference for it in one of the recent emails in this list. How do I find it ?

See the following:

http://sourceforge.net/svn/?group_id=80706

We are using subversion, not cvs.

Eric

···

Thanks in advance,

Wayne

Eric Firing wrote:

If a straightforward plotting sequence, such as one of the examples, does this, then it sounds like a broken installation, not a matplotlib bug.

Based on your comment above, here are my particulars:

1) System is LinuxFromScratch recently built from their SVN book:
        glibc is 2.5, gcc is 4.1.2, X is Xorg 7.2 installed in /usr.

2) Python 2.5.1 with Tkinter enabled. If I run the following script, I get the 'quit' button which when clicked makes the button/window disappear, so I know python and Tkinter are working.

#!/usr/bin/python
from Tkinter import *
class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.grid()
        self.createWidgets()
    def createWidgets(self):
        self.quitButton = Button ( self, text="Quit",command=self.quit )
        self.quitButton.grid()
app = Application()
app.master.title("Sample application")
app.mainloop()

3) Numpy 1.0.3.1 installed without any errors and I can do the following:

>>> import numpy
>>> List = dir(numpy)
>>> len(List)
491
>>>

4) Matplotlib 0.90.1 also installed without error. I set BUILD_TKAGG = 1 which may not have been necessary, but it seems to have worked since in my matplotlibrc file I find "backend : TkAgg". Then if I do this
" python simple_plot.py --verbose-debug", I get the output in the simple_output attachment. The font errors there are the same as what I get in each of my 3 XP installations where matplotlib works just fine, so I don't think they are the cause of the segfault. As I may have described previously, the plot window appears for a fraction of a second and then disappears as the segfault occurs.

I also ran "strace python simple_plot.py --verbose-debug" with the output that's in the strace_output attachment to see if that would give any more information but that output ends at the segfault and I am not knowledgeable enough to understand what it says.

Any help will be appreciated.

Best Regards,

Wayne

simple_output (3.69 KB)

strace_output (2.62 KB)

Wayne,

I'm stumped. Do you get a segfault only with the gui backend? Can you you do this:

import matplotlib
matplotlib.use('Agg')
import pylab
pylab.plot([1,2,3])
pylab.savefig('test.png')

Eric

Wayne E. Harlan wrote:

···

Eric Firing wrote:

If a straightforward plotting sequence, such as one of the examples, does this, then it sounds like a broken installation, not a matplotlib bug.

Based on your comment above, here are my particulars:

1) System is LinuxFromScratch recently built from their SVN book:
       glibc is 2.5, gcc is 4.1.2, X is Xorg 7.2 installed in /usr.

2) Python 2.5.1 with Tkinter enabled. If I run the following script, I get the 'quit' button which when clicked makes the button/window disappear, so I know python and Tkinter are working.

#!/usr/bin/python
from Tkinter import *
class Application(Frame):
   def __init__(self, master=None):
       Frame.__init__(self, master)
       self.grid()
       self.createWidgets()
   def createWidgets(self):
       self.quitButton = Button ( self, text="Quit",command=self.quit )
       self.quitButton.grid()
app = Application()
app.master.title("Sample application")
app.mainloop()

3) Numpy 1.0.3.1 installed without any errors and I can do the following:

>>> import numpy
>>> List = dir(numpy)
>>> len(List)
491
>>>

4) Matplotlib 0.90.1 also installed without error. I set BUILD_TKAGG = 1 which may not have been necessary, but it seems to have worked since in my matplotlibrc file I find "backend : TkAgg". Then if I do this
" python simple_plot.py --verbose-debug", I get the output in the simple_output attachment. The font errors there are the same as what I get in each of my 3 XP installations where matplotlib works just fine, so I don't think they are the cause of the segfault. As I may have described previously, the plot window appears for a fraction of a second and then disappears as the segfault occurs.

I also ran "strace python simple_plot.py --verbose-debug" with the output that's in the strace_output attachment to see if that would give any more information but that output ends at the segfault and I am not knowledgeable enough to understand what it says.

Any help will be appreciated.

Best Regards,

Wayne

------------------------------------------------------------------------

[wayne@...1746...] ~/Programming/Python/matplotlib/examples: python simple_plot.py --verbose-debug matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data
$HOME=/home/wayne
CONFIGDIR=/home/wayne/.matplotlib
loaded rc file /home/wayne/.matplotlib/matplotlibrc
matplotlib version 0.90.1
verbose.level debug
interactive is False
units is True
platform is linux2
loaded modules: ['pylab', 'distutils.distutils', '_bisect', '__future__', 'copy_reg',
'sre_compile', 'distutils', 'itertools', '_hashlib', '_sre', '__main__', 'site', '__
builtin__', 'datetime', 'matplotlib.re', 'matplotlib.tempfile', 'encodings', 'encodin
gs.encodings', 'shutil', 'distutils.string', 'dateutil', 'matplotlib.datetime', 'posi
xpath', '_random', 'tempfile', 'errno', 'matplotlib.warnings', 'binascii', 'encodings
.codecs', 'sre_constants', 're', 'matplotlib.md5', 'os.path', 'pytz.sys', '_codecs', 'distutils.sysconfig', 'pytz.sets', 'math', 'fcntl', 'stat', 'zipimport', 'string', '
warnings', 'encodings.types', 'UserDict', 'encodings.ascii', 'matplotlib.sys', 'matpl
otlib', 'distutils.os', 'sys', 'pytz.tzinfo', 'pytz', 'pytz.datetime', 'matplotlib.__
future__', 'codecs', 'distutils.re', 'matplotlib.pytz', 'types', 'md5', '_types', 'ma
tplotlib.dateutil', 'hashlib', 'matplotlib.os', 'thread', 'bisect', 'matplotlib.distu
tils', 'signal', 'distutils.errors', 'random', 'linecache', 'matplotlib.shutil', 'pos
ix', 'encodings.aliases', 'sets', 'exceptions', 'sre_parse', 'pytz.bisect', 'distutil
s.sys', 'os', 'strop']
numerix numpy 1.0.3.1
font search path ['/usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf', '
/usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/afm']
trying fontname /usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/VeraMo
BI.ttf
trying fontname /usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/VeraSe
.ttf
trying fontname /usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10
.ttf
trying fontname /usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/VeraSe
Bd.ttf
trying fontname /usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10
.ttf
trying fontname /usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/VeraIt
.ttf
trying fontname /usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.
ttf
trying fontname /usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10
.ttf
trying fontname /usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10
.ttf
trying fontname /usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.t
tf
loaded ttfcache file /home/wayne/.matplotlib/ttffont.cache
backend TkAgg version 8.4
        findfont failed Bitstream Vera Serif, New Century Schoolbook, Century Schoolb
ook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Pala
tino, Charter, serif
Could not match Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, U
topia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Ch
arter, serif, normal, normal. Returning /usr/lib/python2.5/site-packages/matplotlib/
mpl-data/fonts/ttf/Vera.ttf
        findfont failed Bitstream Vera Serif, New Century Schoolbook, Century Schoolb
ook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Pala
tino, Charter, serif, normal, normal 400, normal, 14.0
Could not match Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, U
topia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Ch
arter, serif, normal, normal. Returning /usr/lib/python2.5/site-packages/matplotlib/
mpl-data/fonts/ttf/Vera.ttf
Segmentation fault (core dumped)
[wayne@...1746...] ~/Programming/Python/matplotlib/examples:

------------------------------------------------------------------------

futex(0x81d3cc0, FUTEX_WAKE, 1) = 0
munmap(0xb6301000, 1921024) = 0
munmap(0xb64d6000, 1921024) = 0
futex(0x81d3cc0, FUTEX_WAKE, 1) = 0
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0
lstat64("/usr/lib/tk8.4", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib/tk8.4/tclIndex", O_RDONLY|O_LARGEFILE) = 6
fcntl64(6, F_SETFD, FD_CLOEXEC) = 0
ioctl(6, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfcdda28) = -1 ENOTTY (Inappropriate ioctl for device)
read(6, "# Tcl autoload index file, versi"..., 4096) = 4096
read(6, "]]\nset auto_index(::tk::FocusGro"..., 4096) = 4096
read(6, "::tk::MenuDownArrow) [list sourc"..., 4096) = 4096
read(6, " [list source [file join $dir sp"..., 4096) = 4096
read(6, "\nset auto_index(::tk::IconList_A"..., 4096) = 4096
read(6, "_InterpFilter) [list source [fil"..., 4096) = 1730
read(6, "", 4096) = 0
close(6) = 0
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0
open("/usr/lib/tclIndex", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0
lstat64("/usr/lib/tcl8.4", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib/tcl8.4/tclIndex", O_RDONLY|O_LARGEFILE) = 6
fcntl64(6, F_SETFD, FD_CLOEXEC) = 0
ioctl(6, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfcdda28) = -1 ENOTTY (Inappropriate ioctl for device)
read(6, "# Tcl autoload index file, versi"..., 4096) = 4096
read(6, "Name) [list source [file join $d"..., 4096) = 2001
read(6, "", 4096) = 0
close(6) = 0
futex(0x81d3cc0, FUTEX_WAKE, 1) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV (core dumped) +++
Process 1826 detached
[wayne@...1746...] ~/Programming/Python/matplotlib/examples:

I'll second Eric's suggestion.

It might also help to have a backtrace from gdb in addition to your strace output.

Cheers,
Mike

Wayne E. Harlan wrote:

···

Eric Firing wrote:

If a straightforward plotting sequence, such as one of the examples, does this, then it sounds like a broken installation, not a matplotlib bug.

Based on your comment above, here are my particulars:

1) System is LinuxFromScratch recently built from their SVN book:
       glibc is 2.5, gcc is 4.1.2, X is Xorg 7.2 installed in /usr.

2) Python 2.5.1 with Tkinter enabled. If I run the following script, I get the 'quit' button which when clicked makes the button/window disappear, so I know python and Tkinter are working.

#!/usr/bin/python
from Tkinter import *
class Application(Frame):
   def __init__(self, master=None):
       Frame.__init__(self, master)
       self.grid()
       self.createWidgets()
   def createWidgets(self):
       self.quitButton = Button ( self, text="Quit",command=self.quit )
       self.quitButton.grid()
app = Application()
app.master.title("Sample application")
app.mainloop()

3) Numpy 1.0.3.1 installed without any errors and I can do the following:

>>> import numpy
>>> List = dir(numpy)
>>> len(List)
491
>>>

4) Matplotlib 0.90.1 also installed without error. I set BUILD_TKAGG = 1 which may not have been necessary, but it seems to have worked since in my matplotlibrc file I find "backend : TkAgg". Then if I do this
" python simple_plot.py --verbose-debug", I get the output in the simple_output attachment. The font errors there are the same as what I get in each of my 3 XP installations where matplotlib works just fine, so I don't think they are the cause of the segfault. As I may have described previously, the plot window appears for a fraction of a second and then disappears as the segfault occurs.

I also ran "strace python simple_plot.py --verbose-debug" with the output that's in the strace_output attachment to see if that would give any more information but that output ends at the segfault and I am not knowledgeable enough to understand what it says.

Any help will be appreciated.

Best Regards,

Wayne

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
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

Eric Firing wrote:

Wayne,

I'm stumped. Do you get a segfault only with the gui backend? Can you you do this:

import matplotlib
matplotlib.use('Agg')
import pylab
pylab.plot([1,2,3])
pylab.savefig('test.png')

Eric

<previous stuff snipped>

OK, this worked. I have attached the test,png file that resulted. But I don't quite know what this means ...

IDLE 1.2.1 >>> import matplotlib
>>> matplotlib.use('Agg')
>>> import pylab
>>> pylab.plot([1,2,3])
[<matplotlib.lines.Line2D instance at 0x87cd56c>]
>>> pylab.savefig('test.png')
>>>

The other suggestion from Michael about using gdb will have to wait until I download, install and learn to use it, but if that's required, that's what I'll do.

Thanks

Wayne

test.png

Wayne,

Segfaults are generally caused by problems in extension code or libraries. The fact that the plotting works with a non-gui backend indicates that the problem is not in matplotlib's transform or Agg extension code, or in the bits of numpy code that get used along the way. I was pretty sure this would be the case; all of those components are solid and well-tested together, at least for simple plotting.

That tends to throw suspicion on Tkinter/Tk/Tcl or one of mpl's extension bits that is run with Tk. I'm not sure there are any in this case.

One way to narrow it down is to try another gui: gtk or qt. Do you have either of these libraries installed?

Eric

Wayne E. Harlan wrote:

···

Eric Firing wrote:

Wayne,

I'm stumped. Do you get a segfault only with the gui backend? Can you you do this:

import matplotlib
matplotlib.use('Agg')
import pylab
pylab.plot([1,2,3])
pylab.savefig('test.png')

Eric

<previous stuff snipped>

OK, this worked. I have attached the test,png file that resulted. But I don't quite know what this means ...

IDLE 1.2.1 >>> import matplotlib
>>> matplotlib.use('Agg')
>>> import pylab
>>> pylab.plot([1,2,3])
[<matplotlib.lines.Line2D instance at 0x87cd56c>]
>>> pylab.savefig('test.png')
>>>

The other suggestion from Michael about using gdb will have to wait until I download, install and learn to use it, but if that's required, that's what I'll do.

Thanks

Wayne

------------------------------------------------------------------------

Eric:

First thanks for all the help. Here's the scoop after I replied to your earlier post. I thought a bit about the sense of where you were going (it always helps to think a bit). So I decided to try compiling matplotlib with the GTK backend instead of Tk. I have gtk-2.11.5. So I did some sed's to the setup.py file:

sed -i "s|BUILD_GTKAGG = 'auto'|BUILD_GTKAGG = 1|" setup.py &&
sed -i "s|BUILD_GTK = 'auto'|BUILD_GTK = 1|" setup.py &&
sed -i "s|BUILD_TKAGG = 'auto'|BUILD_TKAGG = 0|" setup.py &&

and then proceeded. It turned out that I needed pygtk, so I downloaded that and installed it, but pygtk still complained about not having pycairo (which it says is optional), so I downloaded that. Making a long story short, installing pycairo-1.4.0, pyobject-2.14.0, pygtk-2.10.6 and then reinstalling matplotlib with the above sed's did the trick. I'm displaying all the plots I have been able to in XP (so I don't need XP any more, at least at home).

Once again, thanks for the suggestions. Although I'm set here, I wonder about the tcl/tk issue with matplotlib. I am using tcl/tk-8.4.15. I wonder if it's too new ? Or is there some other package that is needed ?

Wayne

Eric Firing wrote:

···

Wayne,

Segfaults are generally caused by problems in extension code or libraries. The fact that the plotting works with a non-gui backend indicates that the problem is not in matplotlib's transform or Agg extension code, or in the bits of numpy code that get used along the way. I was pretty sure this would be the case; all of those components are solid and well-tested together, at least for simple plotting.

That tends to throw suspicion on Tkinter/Tk/Tcl or one of mpl's extension bits that is run with Tk. I'm not sure there are any in this case.

One way to narrow it down is to try another gui: gtk or qt. Do you have either of these libraries installed?

Eric

Wayne E. Harlan wrote:

Eric Firing wrote:

Wayne,

I'm stumped. Do you get a segfault only with the gui backend? Can you you do this:

import matplotlib
matplotlib.use('Agg')
import pylab
pylab.plot([1,2,3])
pylab.savefig('test.png')

Eric

<previous stuff snipped>

OK, this worked. I have attached the test,png file that resulted. But I don't quite know what this means ...

IDLE 1.2.1 >>> import matplotlib
>>> matplotlib.use('Agg')
>>> import pylab
>>> pylab.plot([1,2,3])
[<matplotlib.lines.Line2D instance at 0x87cd56c>]
>>> pylab.savefig('test.png')
>>>

The other suggestion from Michael about using gdb will have to wait until I download, install and learn to use it, but if that's required, that's what I'll do.

Thanks

Wayne

------------------------------------------------------------------------