segfaults in ipython

Hi I recently posted something about segfaults I get when

    > plotting. Now here is a little update and I really hope
    > someone has an idea how I can solve this problem.

    > I'm running IPython 0.6.13 on a Debian box, installed the
    > recent mpl 0.83.2 from source, GTKAgg backend.

    > 1)

    > When I start ipython (as normal user) with the -pylab
    > option and then say

    > plot([1,2,3])

    > I get

    > In [1]: plot([1,2,3])
    > ---------------------------------------------------------------------------
    > exceptions.SystemError Traceback (most recent call last)

    > SystemError: ../Objects/moduleobject.c:48: bad argument to
    > internal function

You say this is a segfault, but it looks like an exception. Does this
actually kill the ipython shell? Is this a full posting of the
traceback?

What happens if you run the following script outside of ipython

    from pylab import plot, show
    plot([1,2,3])
    show()

with

  > python test.py --verbose-helpful

Does this create a proper figure window -- please post all output from
the script.

    > 2)

    > However when I change to root

    > su <pwd>

    > ipython -pylab

    > then plotting works fine!?

Perhaps this has something to do with having permission to connect to
the X11 server? As a normal user, can you launch graphical apps from
the shell, eg

> gedit&

Have you done anything unusual with your system, changed the default
permission bits, done a chroot, etc? What linux distro are you
running?

    > I have no idea where this moduleobject.c lives or to which
    > application it belongs.

    > 2)

    > If I try the same with the normal python interpreter

    > python

    > from pylab import *; ion() plot([1,2,3])

    > a plot window pops up but shows no picture (no matter if
    > I'm root or not).

GTKAgg is not expected to work unless you are in a special threaded
environment like ipython with -gthread or -pylab. Try the same with
the TkAgg backend (edit your rc file) and let me know what happens.

The last thing I'd advise is upgrading your ipython to the latest.

I've never seen this one before so I'm flying by the seat of my pants.

JDH

I get segfaults with ipython -pylab (and without the flag) quite a bit as well. They usually seem pretty random and frequent, but I found one way to reproduce.

gentoo-linux
ipython-0.6.15
matplotlib-cvs

plot(rand(10))
a = gca()
a.bbox<return>
Segmentation fault

This may not be a practical example, but it is the only consistent one I can find right now.

- Charlie

John Hunter wrote:

···

"Steve" == Steve Schmerler <elcorto@...361...> writes:

    > Hi I recently posted something about segfaults I get when
    > plotting. Now here is a little update and I really hope
    > someone has an idea how I can solve this problem.

    > I'm running IPython 0.6.13 on a Debian box, installed the
    > recent mpl 0.83.2 from source, GTKAgg backend.

    > 1)

    > When I start ipython (as normal user) with the -pylab
    > option and then say

    > plot([1,2,3])

    > I get

    > In [1]: plot([1,2,3])
    > ---------------------------------------------------------------------------
    > exceptions.SystemError Traceback (most recent call last)

    > SystemError: ../Objects/moduleobject.c:48: bad argument to
    > internal function

You say this is a segfault, but it looks like an exception. Does this
actually kill the ipython shell? Is this a full posting of the
traceback?

What happens if you run the following script outside of ipython

    from pylab import plot, show
    plot([1,2,3])
    show()

with

  > python test.py --verbose-helpful

Does this create a proper figure window -- please post all output from
the script.

    > 2)

    > However when I change to root

    > su <pwd>

    > ipython -pylab

    > then plotting works fine!?

Perhaps this has something to do with having permission to connect to
the X11 server? As a normal user, can you launch graphical apps from
the shell, eg

> gedit&

Have you done anything unusual with your system, changed the default
permission bits, done a chroot, etc? What linux distro are you
running?

    > I have no idea where this moduleobject.c lives or to which
    > application it belongs.

    > 2)

    > If I try the same with the normal python interpreter

    > python

    > from pylab import *; ion() plot([1,2,3])

    > a plot window pops up but shows no picture (no matter if
    > I'm root or not).

GTKAgg is not expected to work unless you are in a special threaded
environment like ipython with -gthread or -pylab. Try the same with
the TkAgg backend (edit your rc file) and let me know what happens.

The last thing I'd advise is upgrading your ipython to the latest.

I've never seen this one before so I'm flying by the seat of my pants.

JDH

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * TechWell - Software Conferences, Training, & Resources
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

John Hunter wrote:

"Steve" == Steve Schmerler <elcorto@...361...> writes:

    > Hi I recently posted something about segfaults I get when
    > plotting. Now here is a little update and I really hope
    > someone has an idea how I can solve this problem.

    > I'm running IPython 0.6.13 on a Debian box, installed the
    > recent mpl 0.83.2 from source, GTKAgg backend.

    > 1)

    > When I start ipython (as normal user) with the -pylab
    > option and then say

    > plot([1,2,3])

    > I get

    > In [1]: plot([1,2,3])
    > ---------------------------------------------------------------------------
    > exceptions.SystemError Traceback (most recent call last)

    > SystemError: ../Objects/moduleobject.c:48: bad argument to
    > internal function

You say this is a segfault, but it looks like an exception. Does this
actually kill the ipython shell? Is this a full posting of the
traceback?

I upgraded to IPython 0.6.15 (installed from source), the former 0.6.13 was apt-get installed on Debian (sarge, stable).

Actually, it is a segfault, and it kills the IPython shell.

···

###############################################################################

elcorto@...711...:~/Install/IPython$ ipython -pylab
/usr/lib/python2.3/site-packages/IPython/Shell.py:627: GtkDeprecationWarning: gtk.timeout_add is deprecated, use gobject.timeout_add instead
   self.gtk.timeout_add(self.TIMEOUT, self.on_timer)
Python 2.3.5 (#2, May 4 2005, 08:51:39)
Type "copyright", "credits" or "license" for more information.

IPython 0.6.15 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

   Welcome to pylab, a matplotlib-based Python environment.
   For more information, type 'help(pylab)'.

In [1]: plot([1,2,3])
---------------------------------------------------------------------------
exceptions.SystemError Traceback (most recent call last)

SystemError: ../Objects/moduleobject.c:48: bad argument to internal function
Speicherzugriffsfehler
elcorto@...711...:~/Install/IPython$

#################################################################################

At least "Speicherzugriffsfehler" is german for segfault :slight_smile:

I still can plot as root, but not as user!? If it's some kind of permission problem it would be good to know something about
"../Objects/moduleobject.c". I there a way to get IPython to print the full path?

BTW, Fernando mentioned earlier that this GtkDeprecationWarning would go away if I upgrade to IPython 0.6.15 but unfortunately it's still there.

What happens if you run the following script outside of ipython

    from pylab import plot, show
    plot([1,2,3])
    show()

with

  > python test.py --verbose-helpful

Does this create a proper figure window -- please post all output from
the script.

This works, a window shows up.

#################################################################################

elcorto@...711...:~/Install/IPython$ python test.py --verbose-helpful
matplotlib data path /usr/share/matplotlib
$HOME=/home/elcorto
CONFIGDIR=/home/elcorto/.matplotlib
loaded rc file /usr/share/matplotlib/matplotlibrc
matplotlib version 0.83.2
verbose.level helpful
interactive is False
platform is linux2
numerix Numeric 23.8
font search path ['/usr/share/matplotlib']
loaded ttfcache file /home/elcorto/.matplotlib/ttffont.cache
backend GTKAgg version 2.6.1

#################################################################################

    > 2)

    > However when I change to root

    > su <pwd>

    > ipython -pylab

    > then plotting works fine!?

Perhaps this has something to do with having permission to connect to
the X11 server? As a normal user, can you launch graphical apps from
the shell, eg

> gedit&

I can do that.

Have you done anything unusual with your system, changed the default
permission bits, done a chroot, etc? What linux distro are you
running?

    > I have no idea where this moduleobject.c lives or to which
    > application it belongs.

    > 2)

    > If I try the same with the normal python interpreter

    > python

    > from pylab import *; ion() plot([1,2,3])

    > a plot window pops up but shows no picture (no matter if
    > I'm root or not).

Debian sarge, stable. I'm not a Linux expert but it's a pretty fresh installation (on my computer at work) and I can't see what I should have done wrong. In fact I installed mpl on my (the same) Debian at home and it works fine there (OK it's mpl 0.81 and IPython 0.6.13).

GTKAgg is not expected to work unless you are in a special threaded
environment like ipython with -gthread or -pylab. Try the same with
the TkAgg backend (edit your rc file) and let me know what happens.

Uh, I didn't build TkAgg, So I set BUILD_TKAGG = 'auto', but

  python setup.py build

fails:

[...]

src/_tkagg.cpp:26:19: tk.h: Datei oder Verzeichnis nicht gefunden (file
not found)

[...]

error: command 'gcc' failed with exit status 1

Do I have to install something besides python-tk?

The last thing I'd advise is upgrading your ipython to the latest.

I've never seen this one before so I'm flying by the seat of my pants.

I hope we can sort this out.

cheers,
steve

Steve Schmerler wrote:

I upgraded to IPython 0.6.15 (installed from source), the former 0.6.13 was apt-get installed on Debian (sarge, stable).

Actually, it is a segfault, and it kills the IPython shell.

###############################################################################

elcorto@...711...:~/Install/IPython$ ipython -pylab
/usr/lib/python2.3/site-packages/IPython/Shell.py:627: GtkDeprecationWarning: gtk.timeout_add is deprecated, use gobject.timeout_add instead
   self.gtk.timeout_add(self.TIMEOUT, self.on_timer)
Python 2.3.5 (#2, May 4 2005, 08:51:39)
Type "copyright", "credits" or "license" for more information.

IPython 0.6.15 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

   Welcome to pylab, a matplotlib-based Python environment.
   For more information, type 'help(pylab)'.

In [1]: plot([1,2,3])
---------------------------------------------------------------------------
exceptions.SystemError Traceback (most recent call last)

SystemError: ../Objects/moduleobject.c:48: bad argument to internal function
Speicherzugriffsfehler
elcorto@...711...:~/Install/IPython$

#################################################################################

At least "Speicherzugriffsfehler" is german for segfault :slight_smile:

I still can plot as root, but not as user!? If it's some kind of permission problem it would be good to know something about
"../Objects/moduleobject.c". I there a way to get IPython to print the full path?

No, unfortunately the string:

SystemError: ../Objects/moduleobject.c:48: bad argument to internal function

is being generated internally, so the path has already been truncated by somebody else. IPython has no access to any more info than this, as that string is the value of the exception given to the ipython traceback handler. You can try setting '%xmode verbose' in ipython to produce more verbose tracebacks, but I doubt we'll see anything more meaningful in this particular case (since there don't seem to be any frames properly generated in the traceback).

This is really strange. I can only suggest trying some of the other backends (QtAgg, TKAgg, WXAgg) and seeing what happens. But we're really debugging in the dark here.

BTW, Fernando mentioned earlier that this GtkDeprecationWarning would go away if I upgrade to IPython 0.6.15 but unfortunately it's still there.

Sorry, I should have clarified that this change was made to SVN, _right after_ we released .15. So only an SVN install would make it go away (or manually applying the relevant fix). If it really bothers you, I can track down the exact changes needed for you.

Cheers,

f

Hi

Ups I think I missunderstood the meaning of VERBOSE = True in setup.py when compiling.

When I start ipython -pylab and try to plot mpl prints a lot of mesages and _these_ are the ones of interest, sorry.

OK here is the output of some tests:

Starting iython -pylab:

···

#########################################################################
elcorto@...711...:~/Install/Matplotlib/matplotlib-0.83.2$ ipython -pylab
LazyValue::init_type
Value::init_type
BinOp::init_type
Point::init_type
Interval::init_type
Bbox::init_type
Func::init_type
FuncXY::init_type
Transformation::init_type
SeparableTransformation::init_type
NonseparableTransformation::init_type
Affine::init_type
init_nc_transforms
Glyph::init_type
FT2Font::init_type
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_func
_transforms_module::new_separable_transformation
BBoxTransformation::BBoxTransformation
SeparableTransformation::SeparableTransformation
init_nc_image
Image::init_type
_transforms_module::new_value
Value::~Value
init_nc_backend_agg
/usr/lib/python2.3/site-packages/IPython/Shell.py:627: GtkDeprecationWarning: gtk.timeout_add is deprecated, use gobject.timeout_add instead
   self.gtk.timeout_add(self.TIMEOUT, self.on_timer)
Python 2.3.5 (#2, May 4 2005, 08:51:39)
Type "copyright", "credits" or "license" for more information.

IPython 0.6.15 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

   Welcome to pylab, a matplotlib-based Python environment.
   For more information, type 'help(pylab)'.

In [1]:
#########################################################################

Plotting:
#########################################################################
In [1]: plot([1,2,3])
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_func
_transforms_module::new_separable_transformation
BBoxTransformation::BBoxTransformation
SeparableTransformation::SeparableTransformation
_transforms_module::new_value
_transforms_module::new_point
Point::Point
LazyValue::number
BinOp::BinOp
LazyValue::number
BinOp::BinOp
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_func
_transforms_module::new_separable_transformation
BBoxTransformation::BBoxTransformation
SeparableTransformation::SeparableTransformation
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_func
_transforms_module::new_separable_transformation
BBoxTransformation::BBoxTransformation
SeparableTransformation::SeparableTransformation
SeparableTransformation::~SeparableTransformation
Func::~Func
BBoxTransformation::~BBoxTransformation
Bbox::~Bbox
Point::~Point
Value::~Value
Point::~Point
Value::~Value
Bbox::~Bbox
Point::~Point
Value::~Value
Point::~Point
Value::~Value
Transformation::~Transformation
Value::get
Value::set
Bbox::get_bounds
Value::get
RendererAgg::RendererAgg
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
SeparableTransformation::eval_scalars
Transformation::seq_xy_tups
SeparableTransformation::operator
RendererAgg::draw_polygon
GCAgg::GCAgg
GCAgg::points_to_pixels
GCAgg::get_color
GCAgg::antialiased
GCAgg::_set_linecap
GCAgg::_set_joinstyle
GCAgg::_set_dashes
GCAgg::_set_clip_rectangle
RendererAgg::_get_rgba_face
RendererAgg::rgb_to_color
RendererAgg::set_clipbox_rasterizer
RendererAgg::set_clipbox_rasterizer done
RendererAgg::draw_polygon DONE
---------------------------------------------------------------------------
exceptions.SystemError Traceback (most recent call last)

SystemError: ../Objects/moduleobject.c:48: bad argument to internal function
Speicherzugriffsfehler
elcorto@...711...:~/Install/Matplotlib/matplotlib-0.83.2$
#########################################################################

This was with GTKAgg. The same happens with Agg, TkAgg, GTK.

This bug really annoys me by now and I'm wondering why mpl 0.82 installed as Debian package works.

cheers,
steve