[Numpy-discussion] Packaging numpy with py2app v0.4.3

Donovan Parks donovan.parks@gmail....
Mon Nov 30 15:06:10 CST 2009


I am trying to package a simple python script which uses numpy using
py2app. There was a lengthy discussion about this back in 2006 on this
list, but it doesn't seem relevant anymore given the changes to numpy
and py2app over the last few years. I am hoping someone on this list
has experience with py2app and can give me a hand.

My system is as follows:

OS X Leopard
Python 2.6.4 (installed via MacPort two days ago)
py26-py2app 0.4.3 (installed via MacPort two days ago)
py26-numpy 1.3.0 (installed via MacPort two days ago)

The minimal numpy script I've been working with is:

from numpy import array

a = array( [ 10,20,30,40 ] )
print a

I've been trying to package this with numpy using the following setup.py file:

from setuptools import setup

APP = ['numpyTest.py']
OPTIONS = {'argv_emulation': True}
 options={'py2app': OPTIONS},

When I run 'python setup.py py2app' I get the following error after
py2app starts stripping out debug information:

/usr/bin/strip: for architecture i386 object:
truncated or malformed object (LC_SEGMENT command 2 fileoff field plus
filesize field extends past the end of the file)
stripping saved 2592052 bytes (32431544 / 35023596)

A numpyTest.app file is created in the dist directory. However, when I
try to run this file I get the following error:

ZipImportError: can't decompress data; zlib not available

I tried --no-strip which does cause a clean 'build' from py2app, but I
still get the same error message about zlib. Explicitly adding zlib to
setup.py doesn't change anything. I've also tried going into
numpyTest.app and unzipping the site-packages.zip file, but again this
makes no difference. I'm at a bit of a lost at what to try next since
my understanding is that py2app has a built-in recipe for numpy so
should more-or-less work out of the box. Any insight into what the
stripping error relates to?

Perhaps I am missing something simple here. Does one need to explictly
tell py2app what recipes to use (the documentation doesn't make it
sound that way)? Do I need to explicitly indicate I have a 32-bit or
64-bit system (actually not sure what it is at the moment)?

Thanks for any and all help.


More information about the NumPy-Discussion mailing list