segfault using cx-freeze or bbfreeze with matplotlib TkAgg backend on ubuntu 8.04

Hello,

I am getting segmentation faults when I try to freeze a script which uses the TkAgg backend, on python2.5.2, gcc 4.2.3 (ubuntu 8.04, hardy heron). A trial script is:

import matplotlib
matplotlib.use("TkAgg") # unless you have it in matplotlibrc
import matplotlib.backends.backend_tkagg # explicit for freezer
from matplotlib.pylab import plot, show
plot(range(10), range(10), "+")
show()

Is anyone already familiar with the problem? Things seem to work with the GTkAgg backend, but sadly many years ago I decided to use Tk as I thought it'd be easier to distribute. In order to reproduce the problem with bbfreeze you should just need this freezing script:

from bbfreeze import Freezer
f = Freezer("dist",
           includes=("matplotlib",
                     "matplotlib.numerix.fft",
                     "matplotlib.numerix.linear_algebra",
                     "matplotlib.numerix.ma",
                     "matplotlib.numerix.mlab",
                     "matplotlib.numerix.random_array"))
f.addScript("t.py")
f()

For reproducing the problem with cx-freeze you need to (a) install it by patching the cx-freeze setup.py [so that (2, 5) -> (2, 6)] and (b) add an import for numpy.linalg.lapack_lite and edit your numpy.__init__ to remove numpy.test.

Thanks for any advice,

Jon

···

---

PS: gdb says
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7c806b0 (LWP 8158)]
0xb6e145a0 in ?? () from /home/wright/testcx/build/exe.linux-i686-2.5/matplotlib.backends._tkagg.so
(gdb) bt
#0 0xb6e145a0 in ?? () from /home/wright/testcx/build/exe.linux-i686-2.5/matplotlib.backends._tkagg.so
#1 0xb6badb6e in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
#2 0xb6baee56 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#3 0xb6baf0db in Tcl_EvalObjv () from /usr/lib/libtcl8.4.so.0
#4 0xb6ef96c6 in ?? () from /home/wright/testcx/build/exe.linux-i686-2.5/_tkinter.so
#5 0x0827a0c8 in ?? ()
#6 0x00000005 in ?? ()
...

I assume you're using the matplotlib 0.91.2 that's distributed with Ubuntu 8.04.

There was a recent fix for segfaulting in the exact same place (outside of any sort of freezing apparatus). Since it was related to the interpretation of a pointer, it's possible that you would see this inside of cx-freeze and not outside on the same machine, just because things get loaded into different parts of memory. I would try that fix first, and then look at problems related to freezing.

We should have a new release out shortly, but it's unclear how long that will take to trickle down into Ubuntu repositories.

You can check out the SVN maintenance branch from here (which has this bugfix):

  svn co https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint matplotlib-0.91.x

Let us know how that works for you.

Cheers,
Mike

Jonathan Wright wrote:

···

Hello,

I am getting segmentation faults when I try to freeze a script which uses the TkAgg backend, on python2.5.2, gcc 4.2.3 (ubuntu 8.04, hardy heron). A trial script is:

import matplotlib
matplotlib.use("TkAgg") # unless you have it in matplotlibrc
import matplotlib.backends.backend_tkagg # explicit for freezer
from matplotlib.pylab import plot, show
plot(range(10), range(10), "+")
show()

Is anyone already familiar with the problem? Things seem to work with the GTkAgg backend, but sadly many years ago I decided to use Tk as I thought it'd be easier to distribute. In order to reproduce the problem with bbfreeze you should just need this freezing script:

from bbfreeze import Freezer
f = Freezer("dist",
           includes=("matplotlib",
                     "matplotlib.numerix.fft",
                     "matplotlib.numerix.linear_algebra",
                     "matplotlib.numerix.ma",
                     "matplotlib.numerix.mlab",
                     "matplotlib.numerix.random_array"))
f.addScript("t.py")
f()

For reproducing the problem with cx-freeze you need to (a) install it by patching the cx-freeze setup.py [so that (2, 5) -> (2, 6)] and (b) add an import for numpy.linalg.lapack_lite and edit your numpy.__init__ to remove numpy.test.

Thanks for any advice,

Jon
---

PS: gdb says
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7c806b0 (LWP 8158)]
0xb6e145a0 in ?? () from /home/wright/testcx/build/exe.linux-i686-2.5/matplotlib.backends._tkagg.so
(gdb) bt
#0 0xb6e145a0 in ?? () from /home/wright/testcx/build/exe.linux-i686-2.5/matplotlib.backends._tkagg.so
#1 0xb6badb6e in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
#2 0xb6baee56 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#3 0xb6baf0db in Tcl_EvalObjv () from /usr/lib/libtcl8.4.so.0
#4 0xb6ef96c6 in ?? () from /home/wright/testcx/build/exe.linux-i686-2.5/_tkinter.so
#5 0x0827a0c8 in ?? ()
#6 0x00000005 in ?? ()
...

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. 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

Mike,

That fixes things for me - many thanks. Unrelated, but to build from SVN I had to go diving in setupext.py to say that the tk include files are in:

/usr/include/tcl8.4

... while the tcl install home is /usr/share/tcltk. The command "locate tk.h" was particularly useful.

Many thanks again,

Jon

Michael Droettboom wrote:

···

I assume you're using the matplotlib 0.91.2 that's distributed with Ubuntu 8.04.

There was a recent fix for segfaulting in the exact same place (outside of any sort of freezing apparatus). Since it was related to the interpretation of a pointer, it's possible that you would see this inside of cx-freeze and not outside on the same machine, just because things get loaded into different parts of memory. I would try that fix first, and then look at problems related to freezing.

We should have a new release out shortly, but it's unclear how long that will take to trickle down into Ubuntu repositories.

You can check out the SVN maintenance branch from here (which has this bugfix):

svn co https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint matplotlib-0.91.x

Let us know how that works for you.

Cheers,
Mike

Jonathan Wright wrote:

Hello,

I am getting segmentation faults when I try to freeze a script which uses the TkAgg backend, on python2.5.2, gcc 4.2.3 (ubuntu 8.04, hardy heron). A trial script is:

import matplotlib
matplotlib.use("TkAgg") # unless you have it in matplotlibrc
import matplotlib.backends.backend_tkagg # explicit for freezer
from matplotlib.pylab import plot, show
plot(range(10), range(10), "+")
show()

Is anyone already familiar with the problem? Things seem to work with the GTkAgg backend, but sadly many years ago I decided to use Tk as I thought it'd be easier to distribute. In order to reproduce the problem with bbfreeze you should just need this freezing script:

from bbfreeze import Freezer
f = Freezer("dist",
           includes=("matplotlib",
                     "matplotlib.numerix.fft",
                     "matplotlib.numerix.linear_algebra",
                     "matplotlib.numerix.ma",
                     "matplotlib.numerix.mlab",
                     "matplotlib.numerix.random_array"))
f.addScript("t.py")
f()

For reproducing the problem with cx-freeze you need to (a) install it by patching the cx-freeze setup.py [so that (2, 5) -> (2, 6)] and (b) add an import for numpy.linalg.lapack_lite and edit your numpy.__init__ to remove numpy.test.

Thanks for any advice,

Jon
---

PS: gdb says
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7c806b0 (LWP 8158)]
0xb6e145a0 in ?? () from /home/wright/testcx/build/exe.linux-i686-2.5/matplotlib.backends._tkagg.so

(gdb) bt
#0 0xb6e145a0 in ?? () from /home/wright/testcx/build/exe.linux-i686-2.5/matplotlib.backends._tkagg.so

#1 0xb6badb6e in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
#2 0xb6baee56 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#3 0xb6baf0db in Tcl_EvalObjv () from /usr/lib/libtcl8.4.so.0
#4 0xb6ef96c6 in ?? () from /home/wright/testcx/build/exe.linux-i686-2.5/_tkinter.so
#5 0x0827a0c8 in ?? ()
#6 0x00000005 in ?? ()
...

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. 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