segmentation fault and / or bus error with script that cranks out plots with TkAgg backend

Hi all,

I am running a script that cranks out multiple plots in a loop. The script has plt.show() as the very last line as I think you are supposed to do. All plots show up, but I get a seg fault (sometimes a bus error - I haven’t figured why it occasionally does that) when I close the last plot and the script exits. I was wondering if someone could help me figure out what info to grab to determine what is causing it. I use gentoo and recently did an upgrade world, so I am guessing some new library is not playing nicely as this always seemed to work before. Also, when I switch to Qt4Agg backend,

everything works as expected, but if I can help iron out a bug, I would like to - I really think that matplotlib is an excellent piece of software.

Pertinent info:

uname -a:

  Linux dayd 3.10.15-gentoo #6 SMP Sat Dec 14 15:53:47 MST 2013 x86_64 Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz GenuineIntel GNU/Linux

Matplotlib version - 1.3.1

matplotlibrc:

backend: TkAgg (Qt4Agg works as expected)
interactive: False

because it segfaults
python3.3 testplot.py --verbose-helpful > output.txt

outputs nothing

gcc --version:
gcc (Gentoo 4.8.2 p1.0, pie-0.5.8) 4.8.2

Copyright © 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

script to reproduce the problem:

import sys
import matplotlib.pyplot as plt

def main():
for x in range(6):
plt.figure()
plt.title(x)
plt.plot([1,1],[1,1],‘r.’)

plt.show()

if name == “main”:
sys.exit(main())

I found some instructions on how to get debug info when you install a package in gentoo. If anyone else can recreate this or need some more info from me - please let me know. I will do what I can.

Thanks!

This is a bit of a surprise. Sounds like it could have something to do with matplotlib’s build, or that of some of its dependencies, so may need reporting to Gentoo once we’ve dug a little further. It could be a really tricky one to diagnose without being able to reproduce locally, but - is the loop significant? Does the number of figures matter? Essentially, try to boil it down to as little code as possible (do you need to produce a line plot to reproduce etc.).

Cheers,

···

On 6 January 2014 22:18, tenspd137 . <dcday137@…287…> wrote:

Hi all,

I am running a script that cranks out multiple plots in a loop. The script has plt.show() as the very last line as I think you are supposed to do. All plots show up, but I get a seg fault (sometimes a bus error - I haven’t figured why it occasionally does that) when I close the last plot and the script exits. I was wondering if someone could help me figure out what info to grab to determine what is causing it. I use gentoo and recently did an upgrade world, so I am guessing some new library is not playing nicely as this always seemed to work before. Also, when I switch to Qt4Agg backend,

everything works as expected, but if I can help iron out a bug, I would like to - I really think that matplotlib is an excellent piece of software.

Pertinent info:

uname -a:

Linux dayd 3.10.15-gentoo #6 SMP Sat Dec 14 15:53:47 MST 2013 x86_64 Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz GenuineIntel GNU/Linux

Matplotlib version - 1.3.1

matplotlibrc:

backend: TkAgg (Qt4Agg works as expected)
interactive: False

because it segfaults
python3.3 testplot.py --verbose-helpful > output.txt

outputs nothing

gcc --version:
gcc (Gentoo 4.8.2 p1.0, pie-0.5.8) 4.8.2

Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

script to reproduce the problem:

import sys
import matplotlib.pyplot as plt

def main():
for x in range(6):
plt.figure()
plt.title(x)
plt.plot([1,1],[1,1],‘r.’)

plt.show()

if name == “main”:
sys.exit(main())

I found some instructions on how to get debug info when you install a package in gentoo. If anyone else can recreate this or need some more info from me - please let me know. I will do what I can.

Thanks!


Rapidly troubleshoot problems before they affect your business. Most IT

organizations don’t have a clear picture of how application performance

affects their revenue. With AppDynamics, you get 100% visibility into your

Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!

http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users