Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: py2exe and numarray

Reply
Thread Tools

Re: py2exe and numarray

 
 
Thomas Heller
Guest
Posts: n/a
 
      08-08-2003
Maurício Caliggiuri Inforçati <(E-Mail Removed)> writes:

> > class Teste:
> >
> > def __init__(self):
> >
> > a = array("1","1")
> > print a
> >
> >
> > if __name__ == '__main__' :
> > Teste()


> Sorry, Thomas
> I forgot on line:
> "from numarray import array"
>
> The entire code is exactly this above!
> I use python22 and numarray0.6 (for py22)
>
> The exe is generated but I cant run it!
> This is the output error:
>
> Fatal Python error: Can't import module 'numarray.libnumarray'
> abnormal program termination
>
> Mauricio

This gives a clue, at least.
So the next step would be to run
python setup.py py2exe -i numarray.libnumarray

Having done this, you get this when running the exe:

Traceback (most recent call last):
File "<string>", line 1, in ?
[... several lines deleted]
File "imputil.pyc", line 93, in _import_hook
File "imputil.pyc", line 347, in _do_import
File "imputil.pyc", line 271, in _import_one
File "<string>", line 128, in _process_result
File "numarray\_ufuncall.pyc", line 13, in ?
File "<string>", line 1, in ?
File "imputil.pyc", line 106, in _import_hook
ImportError: No module named _ufuncBool

Not quite there, but we're making progress.
So:
python setup.py py2exe -i "numarray.libnumarray,numarray._ufuncBool"

Then, we get something similar like the above traceback. This time, the
last line of the traceback is:

File "imputil.pyc", line 106, in _import_hook
ImportError: No module named _ufuncInt8

We continue the above a few times, then we discover that abviously
py2exe (or modulefinder, to be precise) has problems finding the .pyd
files in the numarray package. Unfortunately, '--packages numarray'
also doesn't find them - seems like a bug in py2exe.

But the mechanisms to work around this are there. Instead of
constructing a giant command line listing all the stuff, write a
setup.cfg file and place it in the directory where setup.py resides.
This is the contents, it lists all the numarray extension modules:

<setup.cfg>
[py2exe]
includes=numarray.libnumarray,
numarray.memory,
numarray._bytes,
numarray._chararray,
numarray._conv,
numarray._converter,
numarray._ndarray,
numarray._numarray,
numarray._operator,
numarray._sort,
numarray._ufunc,
numarray._ufuncBool,
numarray._ufuncComplex32,
numarray._ufuncComplex64,
numarray._ufuncFloat32,
numarray._ufuncFloat64,
numarray._ufuncInt16,
numarray._ufuncInt32,
numarray._ufuncInt64,
numarray._ufuncInt8,
numarray._ufuncUInt16,
numarray._ufuncUInt32,
numarray._ufuncUInt8
</setup.cfg>

Running 'python setup.py py2exe', and running the resulting executable:
C:\test>dist\test\test.exe
[49]

C:\test>

Bingo, it works!

Thomas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [Py2exe-users] py2exe 0.6.9 released Chris Spencer Python 3 12-08-2008 05:17 PM
RE: [Py2exe-users] py2exe 0.6.9 released Mark Hammond Python 0 11-17-2008 05:27 AM
about py2exe, I installed it, but can't find py2exe.exe in my computer. python Python 3 05-22-2006 02:08 PM
[py2exe] py2exe and datetime -> No module named datetime F. GEIGER Python 0 08-16-2004 01:13 PM
problem w/ numarray & py2exe... RJS Python 0 07-01-2003 06:44 AM



Advertisments