hist() hangs on OSX 10.5

Running a recent build from svn on OSX 10.5, the TkAgg interface
becomes unresponsive after plotting a histogram and calling show().
Here is a sample from the process, in case it is useful:

Sampling process 5635 for 3 seconds with 1 millisecond of run time
between samples
Sampling completed, processing symbols...
Analysis of sampling Python (pid 5635) every 1 millisecond
Call graph:
    2496 Thread_2503
      2496 0x1f84
        2496 Py_Main
          2496 PyRun_SimpleFileExFlags
            2496 PyRun_FileExFlags
              2496 PyErr_Display
                2496 PyEval_EvalCode
                  2496 PyEval_EvalCodeEx
                    2496 PyEval_EvalFrameEx
                      2496 PyEval_EvalCodeEx
                        2496 PyEval_EvalFrameEx
                          2496 PyEval_EvalCodeEx
                            2496 PyEval_EvalFrameEx
                              2496 PyEval_EvalCodeEx
                                2496 PyEval_EvalFrameEx
                                  2496 PyEval_EvalCodeEx
                                    2496 PyEval_EvalFrameEx
                                      2496 PyAST_FromNode
                                        2496 PyOS_Readline
                                          2496 0x4521e0
                                            2496 select$DARWIN_EXTSN
                                              2496 select$DARWIN_EXTSN

Total number in stack (recursive counted multiple, when >=5):
        5 PyEval_EvalCodeEx
        5 PyEval_EvalFrameEx

Sort by top of stack, same collapsed (when >= 5):
        select$DARWIN_EXTSN 2496
Sample analysis of process 5635 written to file /dev/stdout

I'm not seeing this with tkagg on 10.5. hist is working fine for me
both in ipython and running histogram_demo.py -- what tcl/tk are you
building against?

For reference, I'm attaching my build output. My build notes are at
http://ipython.scipy.org/moin/Py4Science/InstallationOSX. Let me know
if any substantive differences leap out at you.

JDH

build.out (108 KB)

···

On Dec 2, 2007 9:23 PM, Chris Fonnesbeck <listservs@...935...> wrote:

Running a recent build from svn on OSX 10.5, the TkAgg interface
becomes unresponsive after plotting a histogram and calling show().
Here is a sample from the process, in case it is useful:

I've just tried installing ActiveState's Tk/Tcl, but I get the
following error when I try to plot anything:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py",
line 1403, in __call__
    return self.func(*args)
  File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py",
line 188, in resize
    self.show()
  File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py",
line 192, in draw
    tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
  File "/Library/Python/2.5/site-packages/matplotlib/backends/tkagg.py",
line 15, in blit
    tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox))
TclError

···

On Dec 2, 2007 10:44 PM, John Hunter <jdh2358@...287...> wrote:

On Dec 2, 2007 9:23 PM, Chris Fonnesbeck <listservs@...935...> wrote:
> Running a recent build from svn on OSX 10.5, the TkAgg interface
> becomes unresponsive after plotting a histogram and calling show().
> Here is a sample from the process, in case it is useful:

I'm not seeing this with tkagg on 10.5. hist is working fine for me
both in ipython and running histogram_demo.py -- what tcl/tk are you
building against?

--
Christopher J. Fonnesbeck
+ Fish & Wildlife Research Institute (FWC)
+ 727.235.5570

Is it only hist that is hanging? Does plot work.... This one has me
a bit stumped.

JDH

···

On Dec 2, 2007 9:23 PM, Chris Fonnesbeck <listservs@...935...> wrote:

Running a recent build from svn on OSX 10.5, the TkAgg interface
becomes unresponsive after plotting a histogram and calling show().
Here is a sample from the process, in case it is useful:

Possibly related to the _tkagg extension -- that's what defines the "PyAggImagePhoto" method. If you installed ActiveState's Tcl/Tk after building matplotlib, that could explain this. Try doing a clean build of matplotlib again (removing the build directory first).

But that's only a suggestion -- I don't use Macs much.

Cheers,
Mike

Chris Fonnesbeck wrote:

···

On Dec 2, 2007 10:44 PM, John Hunter <jdh2358@...287...> wrote:

On Dec 2, 2007 9:23 PM, Chris Fonnesbeck <listservs@...935...> wrote:

Running a recent build from svn on OSX 10.5, the TkAgg interface
becomes unresponsive after plotting a histogram and calling show().
Here is a sample from the process, in case it is useful:

I'm not seeing this with tkagg on 10.5. hist is working fine for me
both in ipython and running histogram_demo.py -- what tcl/tk are you
building against?

I've just tried installing ActiveState's Tk/Tcl, but I get the
following error when I try to plot anything:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py",
line 1403, in __call__
    return self.func(*args)
  File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py",
line 188, in resize
    self.show()
  File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py",
line 192, in draw
    tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
  File "/Library/Python/2.5/site-packages/matplotlib/backends/tkagg.py",
line 15, in blit
    tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox))
TclError

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Same thing. Here is what I did:

In [1]: from matplotlib import use

In [2]: use('TkAgg')

In [3]: from numpy import random

In [4]: x = random.gamma(0.1, 1000, 1000)

In [5]: from pylab import *

In [6]: plot(x)
Out[6]: [<matplotlib.lines.Line2D instance at 0x1dda508>]

In [7]: show()
Exception in Tkinter callback
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py",
line 1403, in __call__
    return self.func(*args)
  File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py",
line 188, in resize
    self.show()
  File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py",
line 192, in draw
    tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
  File "/Library/Python/2.5/site-packages/matplotlib/backends/tkagg.py",
line 15, in blit
    tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox))
TclError

···

On Dec 3, 2007 10:58 AM, John Hunter <jdh2358@...287...> wrote:

On Dec 2, 2007 9:23 PM, Chris Fonnesbeck <listservs@...935...> wrote:
> Running a recent build from svn on OSX 10.5, the TkAgg interface
> becomes unresponsive after plotting a histogram and calling show().
> Here is a sample from the process, in case it is useful:

Is it only hist that is hanging? Does plot work.... This one has me
a bit stumped.

--
Christopher J. Fonnesbeck
+ Fish & Wildlife Research Institute (FWC)
+ 727.235.5570

Thanks for the suggestion. I did do a fresh svn update and build after
installing Tk/Tcl.

···

On Dec 3, 2007 11:04 AM, Michael Droettboom <mdroe@...86...> wrote:

Possibly related to the _tkagg extension -- that's what defines the
"PyAggImagePhoto" method. If you installed ActiveState's Tcl/Tk after
building matplotlib, that could explain this. Try doing a clean build
of matplotlib again (removing the build directory first).

But that's only a suggestion -- I don't use Macs much.

--
Christopher J. Fonnesbeck
+ Fish & Wildlife Research Institute (FWC)
+ 727.235.5570

Sorry for the confusion, I was still on the *old* problem of tkagg
hanging w/ hist, and was wondering if it was hanging with other plot
commands too. Not that you can easily test now w/ the active tcl
install.

···

On Dec 3, 2007 10:08 AM, Chris Fonnesbeck <listservs@...935...> wrote:

On Dec 3, 2007 10:58 AM, John Hunter <jdh2358@...287...> wrote:
> On Dec 2, 2007 9:23 PM, Chris Fonnesbeck <listservs@...935...> wrote:
> > Running a recent build from svn on OSX 10.5, the TkAgg interface
> > becomes unresponsive after plotting a histogram and calling show().
> > Here is a sample from the process, in case it is useful:
>
> Is it only hist that is hanging? Does plot work.... This one has me
> a bit stumped.

Same thing. Here is what I did:

In [1]: from matplotlib import use

Chris, if you get some time to explore this further, I'd like to see
if we can sort it out. If you could remove the acive tcl and do a
clean rebuild of mpl, I'd like to verify the hang still exists, and
whether it is hist or all plot commands, and et some version info (eg
what tcl/tk) and see a copy of the mpl build output. Also, I'd like
to see a run w/ --verbose-debug output. I find it strange because I
am on the same platform and am not having any troubles (yet) with
tkagg.

JDH

···

On Dec 3, 2007 10:13 AM, John Hunter <jdh2358@...287...> wrote:

Sorry for the confusion, I was still on the *old* problem of tkagg
hanging w/ hist, and was wondering if it was hanging with other plot
commands too. Not that you can easily test now w/ the active tcl
install.

John,

I removed ActiveTcl and the hang seems to have disappeared, both for
hist and plot.

cf

···

On Dec 3, 2007 9:41 PM, John Hunter <jdh2358@...287...> wrote:

On Dec 3, 2007 10:13 AM, John Hunter <jdh2358@...287...> wrote:

> Sorry for the confusion, I was still on the *old* problem of tkagg
> hanging w/ hist, and was wondering if it was hanging with other plot
> commands too. Not that you can easily test now w/ the active tcl
> install.

Chris, if you get some time to explore this further, I'd like to see
if we can sort it out. If you could remove the acive tcl and do a
clean rebuild of mpl, I'd like to verify the hang still exists, and
whether it is hist or all plot commands, and et some version info (eg
what tcl/tk) and see a copy of the mpl build output. Also, I'd like
to see a run w/ --verbose-debug output. I find it strange because I
am on the same platform and am not having any troubles (yet) with
tkagg.

--
Christopher J. Fonnesbeck
+ Fish & Wildlife Research Institute (FWC)
+ 727.235.5570