Packaging numpy with py2app v0.4.3
Hello, 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 MacPort 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} setup( app=APP, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) 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: /Users/dparks/test/dist/numpyTest.app/Contents/Frameworks/libgcc_s.1.dylib 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. Regards, Donovan
Donovan Parks wrote: I think this may have nothing at all to do with numpy. Have you tried a simple script that doesn't use numpy?
OS X Leopard MacPort
I use neither Leopard nor macports, so it may be an issue there, but with the python.org python25 and numpy1.3, I have no problems.
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: /Users/dparks/test/dist/numpyTest.app/Contents/Frameworks/libgcc_s.1.dylib truncated or malformed object (LC_SEGMENT command 2 fileoff field plus
note that this is a libgcc error -- you wouldn't need libgcc if you used the python.org build...
ZipImportError: can't decompress data; zlib not available
I tried --no-strip which does cause a clean 'build' from py2app,
I don't think this has anything to do with the stripping (or numpy). py2app, by default, puts all the modules you need into a zipped archive, so any import you do is going to be a problem if zlib is not available. I suspect this may be a macports/py2app incompatibility -- with the python.org python, it probably uses a system zlib, so it hasn't bundled up zlib from macports for you. I'd try asking on the pythonmac list. -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@noaa.gov
participants (2)
-
Christopher Barker
-
Donovan Parks