|
From: Russell E. O. <ro...@ce...> - 2006-09-15 20:48:55
|
I'm trying to figure out a matplotlib crash on MacOS X. When I try to plot anything the program exits with: alloc: invalid block: 0xa08acb4: a 74 0 I first saw this with a program that uses the object interface, but then I tried the simplest pylab demo I could find and the same thing happened. Setup: - matplotlib installed from the universal package at pythonmac.org configured to use numarray (1.5.1) and the TkAgg back end - MacOS X 10.4.3 on a PPC mac - ActiveState Aqua Tcl/Tk 8.4.13 - seen with two different versions of python: - ActiveState python 2.4.3 (PPC-only) - universal Python 2.4.3 (with _tkinter.so modified to find my Tcl/Tk) Any ideas? -- Russell |
|
From: Russell E. O. <ro...@ce...> - 2006-09-15 21:52:57
|
In article <row...@se...>, "Russell E. Owen" <ro...@ce...> wrote: > I'm trying to figure out a matplotlib crash on MacOS X. > > When I try to plot anything the program exits with: > alloc: invalid block: 0xa08acb4: a 74 0 ... some followup info: - This is with matplotlib 0.87.5, but also seen with 0.87.4 and 0.87.2 - This is with ActiveState Tcl/Tk 8.4.11, not 8.4.13 as I originally said I tried the test again with "debug-annoying" level logging. Before running it I: - deleted everything in ~/.matplotlibrc. - .../site-packages/matplotlib/mpl-data to ~/.matplotlibrc and stripped out all but a few options (something I'd never tried before, but I'm hoping it'll leave me a matplotlibrc file that is compatible with future versions of matplotlib, for a change): backend : TkAgg numerix : numarray interactive : False verbose.level : debug-annoying verbose.fileo : sys.stdout I then ran the test: >>> from pylab import * >>> plot([1,2,3,4]) >>> show() The crash happens after the show(): ... RendererAgg.draw_text RendererAgg._get_agg_font alloc: invalid block: 0xa08acb4: a 74 0 The full log is here: <http://rowen.astro.washington.edu/mpl.txt> One other thing that may be relevant (and is in the log): whenever I run matplotlib for the first time after deleting the font cache, I always get a spate of warnings like this: 455: UserWarning: Could not open font file /System/Library/Fonts/LastResort.dfont -- Russell |
|
From: Christopher B. <Chr...@no...> - 2006-09-15 22:12:42
|
Russell E Owen wrote:
> Interesting idea. I'm not sure I'd know how to use more than one numerix
> option at once,
well, I dint' mean more than one numerix option, exactly. What I meant
was that MPL is using numarray, but another module you've imported is
using Numeric (or numpy or whatever).
> but it did inspire me to try a few things:
> backend : TkAgg
> numerix : numarray
> interactive : True
> and the crash still happens:
> from pylab import *
> plot([1,2,3,4])
> I also tried setting numerix to Numeric and it still happens.
Does it happen with wxAgg? or just plain ol Agg? also try the non-agg TK
back-end.
If not, then you've apparently found a tkAgg bug.
TK has always been a bit of a second-class citizen on the Mac -- why
haven't you switched to wx yet? ;-)
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
|
|
From: Russell E O. <ro...@ce...> - 2006-09-15 22:37:28
|
At 3:12 PM -0700 9/15/06, Christopher Barker wrote: >Russell E Owen wrote: >>Interesting idea. I'm not sure I'd know how to use more than one >>numerix option at once, > >well, I dint' mean more than one numerix option, exactly. What I >meant was that MPL is using numarray, but another module you've >imported is using Numeric (or numpy or whatever). Ah. I can guarantee that's happening. Some of my code uses Numeric (due to high speed on short arrays) and some uses numarray (because I started using it for all new code when it looked like it would take over). I hope to switch to numpy for everything once the dust settles, but I don't want to force my users to all move at once (a lot of them are on unix and will have to manually install numpy -- no big deal, but I get complaints every time I require a new package). > > but it did inspire me to try a few things: > >>backend : TkAgg >>numerix : numarray >>interactive : True >>and the crash still happens: >>from pylab import * >>plot([1,2,3,4]) > >>I also tried setting numerix to Numeric and it still happens. > >Does it happen with wxAgg? or just plain ol Agg? also try the >non-agg TK back-end. I don't have wx or gtk installed, so no easy way to test those backends. It does not crash with plain old Agg (but of course I don't see any plot). I'll be happy to try the "non-agg TK back-end" if you can tell me what setting to use for it. I didn't see it in the matplotlibrc's list of options (but WXAgg is also missing from that particular list), nor on the "Which backend should I use?" page. >If not, then you've apparently found a tkAgg bug. > >TK has always been a bit of a second-class citizen on the Mac -- why >haven't you switched to wx yet? ;-) I started this project several years ago and at the time Tcl/Tk was the only game in town for Mac+unix+windows cross-platform support. Admittedly the Mac support was poor, but it has gotten much better, and I like Tkinter pretty well overall. It would be a major job to switch now and I doubt I can justify the expense and time. Sometimes I wish I'd used Java, even though the I strongly prefer Python, just to get a standard GUI. I'll try bulding matplotlib from source, just to see if there might be some quirk about the installer package. -- Russell |
|
From: Russell E. O. <ro...@ce...> - 2006-09-15 22:50:24
|
In article <450...@no...>, Christopher Barker <Chr...@no...> wrote: > Russell E Owen wrote: > > Interesting idea. I'm not sure I'd know how to use more than one numerix > > option at once, > > well, I dint' mean more than one numerix option, exactly. What I meant > was that MPL is using numarray, but another module you've imported is > using Numeric (or numpy or whatever). Ah. I can guarantee that's happening. Some of my code uses Numeric (due to high speed on short arrays) and some uses numarray (because I started using it for all new code when it looked like it would take over). I hope to switch to numpy for everything once the dust settles, but I don't want to force my users to all move at once (a lot of them are on unix and will have to manually install numpy -- no big deal, but I get complaints every time I require a new package). > ...Does it happen with wxAgg? or just plain ol Agg? also try the non-agg TK > back-end. I don't have wx or gtk installed, so no easy way to test those backends. It does not crash with plain old Agg (but of course I don't see any plot). I'll be happy to try the "non-agg TK back-end" if you can tell me what setting to use for it. I didn't see it in the matplotlibrc's list of options (but WXAgg is also missing from that particular list), nor on the "Which backend should I use?" page. > If not, then you've apparently found a tkAgg bug. > > TK has always been a bit of a second-class citizen on the Mac -- why > haven't you switched to wx yet? ;-) I started this project several years ago and at the time Tcl/Tk was the only game in town for Mac+unix+windows cross-platform support. Admittedly the Mac support was poor, but it has gotten much better, and I like Tkinter pretty well overall. It would be a major job to switch now and I doubt I can justify the expense and time. Sometimes I wish I'd used Java, even though the I strongly prefer Python, just to get a standard GUI. I'm bulding matplotlib from source now, just to see if there might be some quirk about the installer package. -- Russell |
|
From: Christopher B. <Chr...@no...> - 2006-09-18 17:01:24
|
Russell E Owen wrote: >> well, I didnt' mean more than one numerix option, exactly. What I meant >> was that MPL is using numarray, but another module you've imported is >> using Numeric (or numpy or whatever). > > Ah. I can guarantee that's happening. Some of my code uses Numeric (due > to high speed on short arrays) and some uses numarray (because I started > using it for all new code when it looked like it would take over). Then this could be it. In general, they should co-exist just fine, but do know someone else has weird crashing problems when they were mixed with MPL (and GDAL, in his case). Both numpy and Numeric, and numarray have a lot of extension code that shares names, etc. who knows what problem that can cause? > I > hope to switch to numpy for everything once the dust settles, good plan, and it's getting close. The API should be stable now. The sooner the better, I think. You'll be a lot more help with bugs or potential bugs like this one. >>> I also tried setting numerix to Numeric and it still happens. Darn. > I don't have wx or gtk installed, so no easy way to test those backends. if you install the mpkg on pythonmac.org/packages, wx should work. that's pretty easy. > It does not crash with plain old Agg (but of course I don't see any plot). Does it save a png successfully? > I'll be happy to try the "non-agg TK back-end" if you can tell me what > setting to use for it. hmm. I just assumed it was there, but I can't find it either. > I started this project several years ago and at the time Tcl/Tk was the > only game in town for Mac+unix+windows cross-platform support. I meant that tongue-in-cheek -- we all have our reasons, and I know you've been using TK for a good long time now. > Sometimes I wish I'd > used Java, even though the I strongly prefer Python, just to get a > standard GUI. which one would that be? AWT? Swing? SWT?, or for that matter, wxJAVA. > I'll try bulding matplotlib from source, just to see if there might be > some quirk about the installer package. It's always worth a shot! -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
|
From: Russell E. O. <ro...@ce...> - 2006-09-18 23:13:19
|
In article <450...@no...>, Christopher Barker <Chr...@no...> wrote: > Russell E Owen wrote: > >> well, I didnt' mean more than one numerix option, exactly. What I meant > >> was that MPL is using numarray, but another module you've imported is > >> using Numeric (or numpy or whatever). > > > > Ah. I can guarantee that's happening. Some of my code uses Numeric (due > > to high speed on short arrays) and some uses numarray (because I started > > using it for all new code when it looked like it would take over). > > Then this could be it. In general, they should co-exist just fine, but > do know someone else has weird crashing problems when they were mixed > with MPL (and GDAL, in his case). Both numpy and Numeric, and numarray > have a lot of extension code that shares names, etc. who knows what > problem that can cause? > > > I > > hope to switch to numpy for everything once the dust settles, > > good plan, and it's getting close. The API should be stable now. The > sooner the better, I think. You'll be a lot more help with bugs or > potential bugs like this one. I look forward to the unification, but unfortunately I don't think it will help with this crash (unless the very fact that the numarray and/or Numeric are installed but not loaded can cause problems). I see the crash even with this trivial script: $ python >>> from pylab import * >>> plot([1,2,3,4]) >>> show() boom! matplotlib 0.87.5 crashes with ~/.matplotlib/matplotlibrc set to use numarray (1.5.1), Numeric or numpy (1.0b5). > > I don't have wx or gtk installed, so no easy way to test those backends. > > if you install the mpkg on pythonmac.org/packages, wx should work. > that's pretty easy. Fair enough. I installed wxPython (2.6) and the above scripts works fine (as long as interactive is false). > > It does not crash with plain old Agg (but of course I don't see any plot). > > Does it save a png successfully? I can try this if you think it will help. It appears to be a lot more work than just slapping up a plot using pylab so I've not tried it yet. I also failed to build matplotlib from source. I had all the prerequisites in /usr/local (and I reinstalled freetype 2.2.1 to be sure, since the version shown in /usr/local/lib has no resemblance to the source version). During the build I see these warnings (but no errors): /usr/bin/ld: for architecture i386 /usr/bin/ld: warning /usr/local/lib/libpng.dylib cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded) and after installation, importation of pylab fails as follows: >>> from pylab import * Traceback (most recent call last): File "<stdin>", line 1, in ? File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pac kages/pylab.py", line 1, in ? from matplotlib.pylab import * File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pac kages/matplotlib/pylab.py", line 200, in ? from axes import Axes, PolarAxes File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pac kages/matplotlib/axes.py", line 15, in ? from axis import XAxis, YAxis File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pac kages/matplotlib/axis.py", line 25, in ? from font_manager import FontProperties File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pac kages/matplotlib/font_manager.py", line 39, in ? from matplotlib import ft2font ImportError: Failure linking new module: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pack ages/matplotlib/ft2font.so: Symbol not found: _FMDisposeFontFamilyIterator Referenced from: /usr/local/lib/libfreetype.6.dylib Expected in: flat namespace -- Russell |