Py2app application with matplotlib fails on OS X 10.6

I’m getting my Py2app build running and think I’ve worked around some issues, but another major one has come up. My application is being built on OS X 10.5.8, where matplotlib is, oviously, installed. On another 10.5.X machine without any of the app’s dependencies, my compiled app runs just fine. Today, I tried getting it running on a new Mac with Snow Leopard, 10.6, and get the following bus error.

From the crash report, it looks like these are relevant:

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 ??? 0000000000 0 + 0
1 libSystem.B.dylib 0x91176aa8 _Unwind_GetLanguageSpecificData + 24
2 libstdc++.6.dylib 0x90057d86 __gxx_personality_v0 + 120

3 libgcc_s.1.dylib 0x03801476 _Unwind_Backtrace + 278
4 libgcc_s.1.dylib 0x03801890 _Unwind_Resume + 112
5 ft2font.so 0x038cd3b1 FT2Font::FT2Font(std::string) + 3737

6 ft2font.so 0x038cd4df ft2font_module::new_ft2font(Py::Tuple const&) + 291
7 ft2font.so 0x038d787f Py::ExtensionModule<ft2font_module>::invoke_method_varargs(std::string const&, Py::Tuple const&) + 261

8 ft2font.so 0x038df637 method_varargs_call_handler + 301

I’m not really sure where to go from here. I’ve read a few other things which hint at Snow Leopard being a bit of a headache: http://bit.ly/2Z2Cil

Has anyone run this setup before? Suggestions?

BZ

We saw the same problem with VisTrails (www.vistrails.org).

It seems that python.org’s python can’t build the fonts in ~/.matplotlib on snow leopard.

We noticed that importing matplotlib.axis using Apple’s python will do that.

So this is the work-around we found for vistrails (bundled with python.org 2.5)

In a terminal on snow leopard:

$ rm -rf ~/.matplotlib
$ cd /Applications/Vistrails.app/Contents/Resources/lib/python2.5
$ DYLD_LIBRARY_PATH=/usr/lib /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python

import matplotlib.axis

Now running the app again works.

The DYLD_LIBRARY_PATH is necessary because of problems we saw with different versions of libgcc_s.1.dylib present in the system and the wrong one was being loaded.

I don’t think it’s a py2app bug because I can reproduce it by just running python.org’s python and importing matplotlib.axis.

I guess it is a bug in matplotlib.

– Emanuele.

···

On Nov 9, 2009, at 11:46 PM, Brian Zambrano wrote:

I’m getting my Py2app build running and think I’ve worked around some issues, but another major one has come up. My application is being built on OS X 10.5.8, where matplotlib is, oviously, installed. On another 10.5.X machine without any of the app’s dependencies, my compiled app runs just fine. Today, I tried getting it running on a new Mac with Snow Leopard, 10.6, and get the following bus error.

From the crash report, it looks like these are relevant:

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 ??? 0000000000 0 + 0
1 libSystem.B.dylib 0x91176aa8 _Unwind_GetLanguageSpecificData + 24
2 libstdc++.6.dylib 0x90057d86 __gxx_personality_v0 + 120

3 libgcc_s.1.dylib 0x03801476 _Unwind_Backtrace + 278
4 libgcc_s.1.dylib 0x03801890 _Unwind_Resume + 112
5 ft2font.so 0x038cd3b1 FT2Font::FT2Font(std::string) + 3737

6 ft2font.so 0x038cd4df ft2font_module::new_ft2font(Py::Tuple const&) + 291
7 ft2font.so 0x038d787f Py::ExtensionModule<ft2font_module>::invoke_method_varargs(std::string const&, Py::Tuple const&) + 261

8 ft2font.so 0x038df637 method_varargs_call_handler + 301

I’m not really sure where to go from here. I’ve read a few other things which hint at Snow Leopard being a bit of a headache: http://bit.ly/2Z2Cil

Has anyone run this setup before? Suggestions?

BZ


Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what’s new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Following those steps, my app started just fine on Snow Leopard. Thank you Emanuele!

I would, however, like to understand this problem a bit more so I can fix the build. I’d like this app to run out of the box.

Looking at ft2font.so:

otool -L Resources/lib/python2.5/matplotlib/ft2font.so
Resources/lib/python2.5/matplotlib/ft2font.so:
@executable_path/…/Frameworks/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.12.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3)
@executable_path/…/Frameworks/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

For matplotlib to load successfully, which libgcc should be loaded?

Thanks again,
BZ

···

On Mon, Nov 9, 2009 at 11:45 PM, Emanuele Santos <emanuelesantos@…287…> wrote:

We saw the same problem with VisTrails (www.vistrails.org).

It seems that python.org’s python can’t build the fonts in ~/.matplotlib on snow leopard.

We noticed that importing matplotlib.axis using Apple’s python will do that.

So this is the work-around we found for vistrails (bundled with python.org 2.5)

In a terminal on snow leopard:

$ rm -rf ~/.matplotlib
$ cd /Applications/Vistrails.app/Contents/Resources/lib/python2.5
$ DYLD_LIBRARY_PATH=/usr/lib /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python

import matplotlib.axis

Now running the app again works.

The DYLD_LIBRARY_PATH is necessary because of problems we saw with different versions of libgcc_s.1.dylib present in the system and the wrong one was being loaded.

I don’t think it’s a py2app bug because I can reproduce it by just running python.org’s python and importing matplotlib.axis.

I guess it is a bug in matplotlib.

– Emanuele.

On Nov 9, 2009, at 11:46 PM, Brian Zambrano wrote:

I’m getting my Py2app build running and think I’ve worked around some issues, but another major one has come up. My application is being built on OS X 10.5.8, where matplotlib is, oviously, installed. On another 10.5.X machine without any of the app’s dependencies, my compiled app runs just fine. Today, I tried getting it running on a new Mac with Snow Leopard, 10.6, and get the following bus error.

From the crash report, it looks like these are relevant:

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 ??? 0000000000 0 + 0
1 libSystem.B.dylib 0x91176aa8 _Unwind_GetLanguageSpecificData + 24
2 libstdc++.6.dylib 0x90057d86 __gxx_personality_v0 + 120

3 libgcc_s.1.dylib 0x03801476 _Unwind_Backtrace + 278
4 libgcc_s.1.dylib 0x03801890 _Unwind_Resume + 112
5 ft2font.so 0x038cd3b1 FT2Font::FT2Font(std::string) + 3737

6 ft2font.so 0x038cd4df ft2font_module::new_ft2font(Py::Tuple const&) + 291
7 ft2font.so 0x038d787f Py::ExtensionModule<ft2font_module>::invoke_method_varargs(std::string const&, Py::Tuple const&) + 261

8 ft2font.so 0x038df637 method_varargs_call_handler + 301

I’m not really sure where to go from here. I’ve read a few other things which hint at Snow Leopard being a bit of a headache: http://bit.ly/2Z2Cil

Has anyone run this setup before? Suggestions?

BZ


Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on

what you do best, core application coding. Discover what’s new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july_______________________________________________

Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day

trial. Simplify your report design, integration and deployment - and focus on

what you do best, core application coding. Discover what’s new with

Crystal Reports now. http://p.sf.net/sfu/bobj-july


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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

It should load /usr/lib/libgcc_s.1.dylib. The problem is that the binary package of matplotlib for mac is linked against /usr/local/lib/libgcc_s.1.dylib.

I tried using install_name_tool and change this on the bundle and it does the trick.

$ cd Resources/lib/python2.5

install_name_tool -change @executable_path/…/Frameworks/libgcc_s.1.dylib /usr/lib/libgcc_s.1.dylib ft2font.so

– Emanuele.

···

On Nov 10, 2009, at 9:43 AM, Brian Zambrano wrote:

Following those steps, my app started just fine on Snow Leopard. Thank you Emanuele!

I would, however, like to understand this problem a bit more so I can fix the build. I’d like this app to run out of the box.

Looking at ft2font.so:

otool -L Resources/lib/python2.5/matplotlib/ft2font.so
Resources/lib/python2.5/matplotlib/ft2font.so:
@executable_path/…/Frameworks/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.12.0)

    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3)

    @executable_path/../Frameworks/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

For matplotlib to load successfully, which libgcc should be loaded?

Thanks again,
BZ

On Mon, Nov 9, 2009 at 11:45 PM, Emanuele Santos <emanuelesantos@…287…> wrote:

We saw the same problem with VisTrails (www.vistrails.org).

It seems that python.org’s python can’t build the fonts in ~/.matplotlib on snow leopard.

We noticed that importing matplotlib.axis using Apple’s python will do that.

So this is the work-around we found for vistrails (bundled with python.org 2.5)

In a terminal on snow leopard:

$ rm -rf ~/.matplotlib
$ cd /Applications/Vistrails.app/Contents/Resources/lib/python2.5
$ DYLD_LIBRARY_PATH=/usr/lib /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python

import matplotlib.axis

Now running the app again works.

The DYLD_LIBRARY_PATH is necessary because of problems we saw with different versions of libgcc_s.1.dylib present in the system and the wrong one was being loaded.

I don’t think it’s a py2app bug because I can reproduce it by just running python.org’s python and importing matplotlib.axis.

I guess it is a bug in matplotlib.

– Emanuele.

On Nov 9, 2009, at 11:46 PM, Brian Zambrano wrote:

I’m getting my Py2app build running and think I’ve worked around some issues, but another major one has come up. My application is being built on OS X 10.5.8, where matplotlib is, oviously, installed. On another 10.5.X machine without any of the app’s dependencies, my compiled app runs just fine. Today, I tried getting it running on a new Mac with Snow Leopard, 10.6, and get the following bus error.

From the crash report, it looks like these are relevant:

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 ??? 0000000000 0 + 0
1 libSystem.B.dylib 0x91176aa8 _Unwind_GetLanguageSpecificData + 24
2 libstdc++.6.dylib 0x90057d86 __gxx_personality_v0 + 120

3 libgcc_s.1.dylib 0x03801476 _Unwind_Backtrace + 278
4 libgcc_s.1.dylib 0x03801890 _Unwind_Resume + 112
5 ft2font.so 0x038cd3b1 FT2Font::FT2Font(std::string) + 3737

6 ft2font.so 0x038cd4df ft2font_module::new_ft2font(Py::Tuple const&) + 291
7 ft2font.so 0x038d787f Py::ExtensionModule<ft2font_module>::invoke_method_varargs(std::string const&, Py::Tuple const&) + 261

8 ft2font.so 0x038df637 method_varargs_call_handler + 301

I’m not really sure where to go from here. I’ve read a few other things which hint at Snow Leopard being a bit of a headache: http://bit.ly/2Z2Cil

Has anyone run this setup before? Suggestions?

BZ


Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on

what you do best, core application coding. Discover what’s new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july_______________________________________________

Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day

trial. Simplify your report design, integration and deployment - and focus on

what you do best, core application coding. Discover what’s new with

Crystal Reports now. http://p.sf.net/sfu/bobj-july


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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


Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what’s new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

– Emanuele.

Emanuele Santos wrote:

It should load /usr/lib/libgcc_s.1.dylib. The problem is that the binary package of matplotlib for mac is linked against /usr/local/lib/libgcc_s.1.dylib.

ouch -- it shouldn't be. Did you build it yourself or is that the "official" one?

Also, it seems that Py2app really should include libs that are in /usr/local with the bundle, so that may be a py2app bug/feature.

Boy, this is a pain!

oh well,

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Hi, Chris

I think it is the official one (0.98.5).
I didn't try the latest version but I can check if this is still true.

-- Emanuele.

···

On Nov 10, 2009, at 11:14 AM, Christopher Barker wrote:

Emanuele Santos wrote:

It should load /usr/lib/libgcc_s.1.dylib. The problem is that the binary
package of matplotlib for mac is linked
against /usr/local/lib/libgcc_s.1.dylib.

ouch -- it shouldn't be. Did you build it yourself or is that the
"official" one?

Also, it seems that Py2app really should include libs that are in
/usr/local with the bundle, so that may be a py2app bug/feature.

Boy, this is a pain!

oh well,

-Chris

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-- Emanuele.

Could you please -- there were some bugs in linking on the OSX
binaries that were fixed between 0.98.5 and 0.99.1 so I'd like to
confirm that this was fixes as well

···

On Tue, Nov 10, 2009 at 1:26 PM, Emanuele Santos <emanuelesantos@...287...> wrote:

Hi, Chris

I think it is the official one (0.98.5).
I didn't try the latest version but I can check if this is still true.

FWIW, I’m using the official 0.98.5.

Looking at the app bundle, all of the matplotlib .so files are linking against:

@executable_path/…/Frameworks/libgcc_s.1.dylib

except matplotlib/backends/_macosx.so which is linking against:

/usr/lib/libgcc_s.1.dylib

So, I didn’t see any looking in /usr/local/lib.

BZ

···

On Tue, Nov 10, 2009 at 11:57 AM, John Hunter <jdh2358@…287…> wrote:

On Tue, Nov 10, 2009 at 1:26 PM, Emanuele Santos > > <emanuelesantos@…287…> wrote:

Hi, Chris

I think it is the official one (0.98.5).

I didn’t try the latest version but I can check if this is still true.

Could you please – there were some bugs in linking on the OSX

binaries that were fixed between 0.98.5 and 0.99.1 so I’d like to

confirm that this was fixes as well

I

Hi, Chris

I think it is the official one (0.98.5).
I didn’t try the latest version but I can check if this is still true.

Could you please – there were some bugs in linking on the OSX
binaries that were fixed between 0.98.5 and 0.99.1 so I’d like to
confirm that this was fixes as well

I just checked and it seems to be fixed in 0.99.1.

– Emanuele.

···

On Tue, Nov 10, 2009 at 11:57 AM, John Hunter <jdh2358@…287…> wrote:

On Tue, Nov 10, 2009 at 1:26 PM, Emanuele Santos > > <emanuelesantos@…287…> wrote:


Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what’s new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@…504…et
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I just upgraded to 0.99.1 and it’s working perfectly now. I was previously hacking _png.so with install_name_tool, and that’s not necessary anymore as well.

Thank you to Emanuele and everyone else…much appreciated!

BZ

···

On Tue, Nov 10, 2009 at 1:38 PM, Emanuele Santos <emanuelesantos@…287…> wrote:

On Tue, Nov 10, 2009 at 11:57 AM, John Hunter <jdh2358@…287…> wrote:

On Tue, Nov 10, 2009 at 1:26 PM, Emanuele Santos > > > <emanuelesantos@…287…> wrote:

Hi, Chris

I think it is the official one (0.98.5).
I didn’t try the latest version but I can check if this is still true.

Could you please – there were some bugs in linking on the OSX

binaries that were fixed between 0.98.5 and 0.99.1 so I’d like to
confirm that this was fixes as well

I just checked and it seems to be fixed in 0.99.1.

– Emanuele.