segfault in matplotlib

here is the sample code "embedding_in_gtk2.py"

6 import gtk
7
8 from matplotlib.figure import Figure
9 from numpy import arange, sin, pi
10
11 # uncomment to select /GTK/GTKAgg/GTKCairo
12 #from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
13 from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
as FigureCanvas
14 #from matplotlib.backends.backend_gtkcairo import
FigureCanvasGTKCairo as FigureCanvas
15
16 # or NavigationToolbar for classic
17 #from matplotlib.backends.backend_gtk import NavigationToolbar2GTK
as NavigationToolbar
18 from matplotlib.backends.backend_gtkagg import
NavigationToolbar2GTKAgg as NavigationToolbar
19
20
21 win = gtk.Window()
22 win.connect("destroy", lambda x: gtk.main_quit())
23 win.set_default_size(400,300)
24 win.set_title("Embedding in GTK")
25
26 vbox = gtk.VBox()
27 win.add(vbox)
28
29 fig = Figure(figsize=(5,4), dpi=100)
30 import pudb
31 pudb.set_trace()
32 ax = fig.add_subplot(111)
33 t = arange(0.0,3.0,0.01)
34 s = sin(2*pi*t)
35
36 ax.plot(t,s)
37
38
39 canvas = FigureCanvas(fig) # a gtk.DrawingArea
40 vbox.pack_start(canvas)
41 toolbar = NavigationToolbar(canvas, win)
42 vbox.pack_start(toolbar, False, False)
43
44
45 win.show_all()
46 gtk.main()

on line 36 error segfault.
Here is the gdb session

Starting program: /usr/bin/python2.7 embedding_in_gtk2.py
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007fffeda71594 in __cxa_allocate_exception () from
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/libstdc++.so.6
#0 0x00007fffeda71594 in __cxa_allocate_exception () from
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/libstdc++.so.6
#1 0x00007fffe4830164 in py_to_agg_transformation_matrix(_object*, bool) ()
   from /usr/lib64/python2.7/site-packages/matplotlib/_path.so
#2 0x00007fffe483addb in _path_module::update_path_extents(Py::Tuple const&) ()
   from /usr/lib64/python2.7/site-packages/matplotlib/_path.so
#3 0x00007fffe4841ad8 in
Py::ExtensionModule<_path_module>::invoke_method_varargs(void*,
Py::Tuple const&) ()
   from /usr/lib64/python2.7/site-packages/matplotlib/_path.so
#4 0x00007fffe482b54d in method_varargs_call_handler () from
/usr/lib64/python2.7/site-packages/matplotlib/_path.so
#5 0x00007ffff7b09a7b in PyEval_EvalFrameEx () from
/usr/lib64/libpython2.7.so.1.0
#6 0x00007ffff7b0b658 in PyEval_EvalCodeEx () from
/usr/lib64/libpython2.7.so.1.0
#7 0x00007ffff7b09bc7 in PyEval_EvalFrameEx () from
/usr/lib64/libpython2.7.so.1.0
#8 0x00007ffff7b0b658 in PyEval_EvalCodeEx () from
/usr/lib64/libpython2.7.so.1.0
#9 0x00007ffff7b09bc7 in PyEval_EvalFrameEx () from
/usr/lib64/libpython2.7.so.1.0
#10 0x00007ffff7b0b658 in PyEval_EvalCodeEx () from
/usr/lib64/libpython2.7.so.1.0
#11 0x00007ffff7b09bc7 in PyEval_EvalFrameEx () from
/usr/lib64/libpython2.7.so.1.0
#12 0x00007ffff7b0b658 in PyEval_EvalCodeEx () from
/usr/lib64/libpython2.7.so.1.0
#13 0x00007ffff7b09bc7 in PyEval_EvalFrameEx () from
/usr/lib64/libpython2.7.so.1.0
#14 0x00007ffff7b0b658 in PyEval_EvalCodeEx () from
/usr/lib64/libpython2.7.so.1.0
#15 0x00007ffff7b0b762 in PyEval_EvalCode () from /usr/lib64/libpython2.7.so.1.0
#16 0x00007ffff7b2545c in ?? () from /usr/lib64/libpython2.7.so.1.0
#17 0x00007ffff7b25530 in PyRun_FileExFlags () from
/usr/lib64/libpython2.7.so.1.0
#18 0x00007ffff7b26a1f in PyRun_SimpleFileExFlags () from
/usr/lib64/libpython2.7.so.1.0
#19 0x00007ffff7b377cc in Py_Main () from /usr/lib64/libpython2.7.so.1.0
#20 0x00007ffff74d4bad in __libc_start_main () from /lib64/libc.so.6
#21 0x00000000004008c9 in _start ()

I have python 2.7.1 and amd64 linux distributive (gentoo). I did not
see this problem on x86 linux.
Thanks.

This is a shot in the dark, but I've seen this before when matplotlib didn't get fully rebuilt after a numpy upgrade.

Mike

···

On 08/04/2011 01:13 PM, Alexey Uimanov wrote:

here is the sample code "embedding_in_gtk2.py"

  6 import gtk
  7
  8 from matplotlib.figure import Figure
  9 from numpy import arange, sin, pi
10
11 # uncomment to select /GTK/GTKAgg/GTKCairo
12 #from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
13 from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
as FigureCanvas
14 #from matplotlib.backends.backend_gtkcairo import
FigureCanvasGTKCairo as FigureCanvas
15
16 # or NavigationToolbar for classic
17 #from matplotlib.backends.backend_gtk import NavigationToolbar2GTK
as NavigationToolbar
18 from matplotlib.backends.backend_gtkagg import
NavigationToolbar2GTKAgg as NavigationToolbar
19
20
21 win = gtk.Window()
22 win.connect("destroy", lambda x: gtk.main_quit())
23 win.set_default_size(400,300)
24 win.set_title("Embedding in GTK")
25
26 vbox = gtk.VBox()
27 win.add(vbox)
28
29 fig = Figure(figsize=(5,4), dpi=100)
30 import pudb
31 pudb.set_trace()
32 ax = fig.add_subplot(111)
33 t = arange(0.0,3.0,0.01)
34 s = sin(2*pi*t)
35
36 ax.plot(t,s)
37
38
39 canvas = FigureCanvas(fig) # a gtk.DrawingArea
40 vbox.pack_start(canvas)
41 toolbar = NavigationToolbar(canvas, win)
42 vbox.pack_start(toolbar, False, False)
43
44
45 win.show_all()
46 gtk.main()

on line 36 error segfault.
Here is the gdb session

Starting program: /usr/bin/python2.7 embedding_in_gtk2.py
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007fffeda71594 in __cxa_allocate_exception () from
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/libstdc++.so.6
#0 0x00007fffeda71594 in __cxa_allocate_exception () from
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/libstdc++.so.6
#1 0x00007fffe4830164 in py_to_agg_transformation_matrix(_object*, bool) ()
    from /usr/lib64/python2.7/site-packages/matplotlib/_path.so
#2 0x00007fffe483addb in _path_module::update_path_extents(Py::Tuple const&) ()
    from /usr/lib64/python2.7/site-packages/matplotlib/_path.so
#3 0x00007fffe4841ad8 in
Py::ExtensionModule<_path_module>::invoke_method_varargs(void*,
Py::Tuple const&) ()
    from /usr/lib64/python2.7/site-packages/matplotlib/_path.so
#4 0x00007fffe482b54d in method_varargs_call_handler () from
/usr/lib64/python2.7/site-packages/matplotlib/_path.so
#5 0x00007ffff7b09a7b in PyEval_EvalFrameEx () from
/usr/lib64/libpython2.7.so.1.0
#6 0x00007ffff7b0b658 in PyEval_EvalCodeEx () from
/usr/lib64/libpython2.7.so.1.0
#7 0x00007ffff7b09bc7 in PyEval_EvalFrameEx () from
/usr/lib64/libpython2.7.so.1.0
#8 0x00007ffff7b0b658 in PyEval_EvalCodeEx () from
/usr/lib64/libpython2.7.so.1.0
#9 0x00007ffff7b09bc7 in PyEval_EvalFrameEx () from
/usr/lib64/libpython2.7.so.1.0
#10 0x00007ffff7b0b658 in PyEval_EvalCodeEx () from
/usr/lib64/libpython2.7.so.1.0
#11 0x00007ffff7b09bc7 in PyEval_EvalFrameEx () from
/usr/lib64/libpython2.7.so.1.0
#12 0x00007ffff7b0b658 in PyEval_EvalCodeEx () from
/usr/lib64/libpython2.7.so.1.0
#13 0x00007ffff7b09bc7 in PyEval_EvalFrameEx () from
/usr/lib64/libpython2.7.so.1.0
#14 0x00007ffff7b0b658 in PyEval_EvalCodeEx () from
/usr/lib64/libpython2.7.so.1.0
#15 0x00007ffff7b0b762 in PyEval_EvalCode () from /usr/lib64/libpython2.7.so.1.0
#16 0x00007ffff7b2545c in ?? () from /usr/lib64/libpython2.7.so.1.0
#17 0x00007ffff7b25530 in PyRun_FileExFlags () from
/usr/lib64/libpython2.7.so.1.0
#18 0x00007ffff7b26a1f in PyRun_SimpleFileExFlags () from
/usr/lib64/libpython2.7.so.1.0
#19 0x00007ffff7b377cc in Py_Main () from /usr/lib64/libpython2.7.so.1.0
#20 0x00007ffff74d4bad in __libc_start_main () from /lib64/libc.so.6
#21 0x00000000004008c9 in _start ()

I have python 2.7.1 and amd64 linux distributive (gentoo). I did not
see this problem on x86 linux.
Thanks.

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos& much more. Register early& save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA