[Pythonmac-SIG] [Numpy-discussion] Packaging numpy with py2app

Christopher Barker Chris.Barker at noaa.gov
Tue Jul 18 01:21:54 CEST 2006


Josh,

Have you gotten this working yet? I can't get a very simple numpy-using 
script to work. MPL will come later for me.


> On Jul 16, 2006, at 5:22 PM, Josh Marshall wrote:

>> I managed to get it working again, which required:
>> 1) Setting packages=['matplotlib','numpy'] in setup.py's options for
>> py2app.

where did you so this? I have this simple setup.py:

#!/usr/bin/env python2.4
"""
Usage:
     % python setup.py py2app
"""
from distutils.core import setup
import py2app

setup(
     app = [dict(script = 'NumpyTest.py',
                 packages = ['numpy']
                 )],


Have I added the packages in the wrong place? I get errors that look 
like this when I try to run it:

AttributeError: 'module' object has no attribute 'dtype'
Warning: unrecognized command line flag -psn_0_74448897
No scipy-style subpackage 'core' found in 
/Users/cbarker/junk/dist/NumpyTest.app/Contents/Resources/lib/python2.4/site-packages.zip/numpy. 
Ignoring: No module named _internal
...
Traceback (most recent call last):
   File 
"/Users/cbarker/junk/dist/NumpyTest.app/Contents/Resources/__boot__.py", 
line 31, in ?
     _run('NumpyTest.py')
   File 
"/Users/cbarker/junk/dist/NumpyTest.app/Contents/Resources/__boot__.py", 
line 28, in _run
     execfile(path, globals(), globals())
   File 
"/Users/cbarker/junk/dist/NumpyTest.app/Contents/Resources/NumpyTest.py", 
line 3, in ?
     import numpy as N
   File "numpy/__init__.pyc", line 35, in ?
   File "numpy/_import_tools.pyc", line 173, in __call__
   File "numpy/_import_tools.pyc", line 68, in _init_info_modules
   File "<string>", line 1, in ?
   File "numpy/random/__init__.pyc", line 3, in ?
   File "numpy/random/mtrand.pyc", line 18, in ?
   File "numpy/random/mtrand.pyc", line 11, in __load
   File "numpy.pxi", line 32, in mtrand
AttributeError: 'module' object has no attribute 'dtype'

Bob Ippolito wrote:
> That's a bug, but not the right fix. Trunk is fixed.

I tried this with svn trunk too, and got the same results.

By the way, I tried building svn trunk with bdist_mpkg, and giving the 
resulting package to someone else, and it didn't work. It couldn't 
import py2app, and when I looked at waht was installed, it didn't look 
right.

If you have a setup.py that works for you, could you please post the 
whole thing?

 > nor do I have an example I
> can test with so I'm not going to do it.

It's certainly easy enough to give you examples! but it's up to us to 
write the recipes anyway.

-thanks,
-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

Chris.Barker at noaa.gov


More information about the Pythonmac-SIG mailing list