OSX CDAT Matplotlib interactive plots crash

Dean N. Williams wrote:

Hi Jeff,

    You are correct on both assumptions below. On the Mac, we know how to build CDAT using framework and have done so for various projects. Is there a huge advantage for building CDAT on the Mac using framework? Perhaps in the future we will do this as the default.

Thanks for the help on this.

Best regards,

Dean: If you use a framework build, you can use the builtin mac-native Tk and Wx. If you use unix python, you must use X11 versions of the toolkits. Personally, I don't mind that, but a lot of people don't want to mess with X11. I like it because you can run stuff on your mac remotely and display windows over an ssh tunnel.



On Oct 2, 2008, at 4:39 AM, Jeff Whitaker wrote:

Andrew Charles wrote:

The latest beta of CDAT (Climate Data Analysis Tools, widely used in
the atmospheric/oceanographic sciences) is distributed with the
matplotlib source included.

On OSX, while it seems to compile without a hitch, plotting
interactively (or calling show() ) with the TkAgg backend results in a
seg fault. The non-interactive backends have so far worked just fine.

The output from a simple interactive hello world line plot with
--verbose-helpful set is:

Executing /opt/cdat/bin/python
matplotlib data path /opt/cdat/lib/python2.5/site-packages/matplotlib/mpl-data
loaded rc file /opt/cdat/lib/python2.5/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 0.98.3
verbose.level helpful
interactive is False
units is False
platform is darwin
Using fontManager instance from /Users/acharles/.matplotlib/fontManager.cache
backend TkAgg version 8.5
Testing matplotlib
Segmentation fault

CDAT builds almost everything from source. I've always found building
matplotlib for OSX to be tricky, so tend to just install binary eggs
these days. Nevertheless I have tried a couple of solutions:

1. setting export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig
2. editing setupext.py to put the system X11 libraries ahead of any
fink/macports versions
3. setting CFLAGS="-Os -arch i386 -arch ppc" LDFLAGS="-Os -arch i386 -arch ppc"

but to no avail. Is there a simple solution that can be applied to the
script that builds matplotlib?

Andrew: I think I ran into this before. Correct me if I'm wrong ..

1) CDAT builds a unix version (not a framework build) of python for you, and installs itself in the unix python.
2) CDAT links against X11 versions of all the GUI toolkits (including Tk).

I think the segfault happens because you're picking up either the headers or libs for the framework version of Tk included with MacOS X. You need to use an X11 build. To fix this, you need to edit the matplotlib setupext.py file to make sure that it's not finding the framework version of Tk (i.e, make sure the variable tk_framework ends up being zero or False).



Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328

Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328