Re: py2exe and numarray

Discussion in 'Python' started by Thomas Heller, Aug 8, 2003.

  1. Maurício Caliggiuri Inforçati <> 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
     
    Thomas Heller, Aug 8, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RJS
    Replies:
    0
    Views:
    495
  2. F. GEIGER
    Replies:
    0
    Views:
    951
    F. GEIGER
    Aug 16, 2004
  3. python
    Replies:
    3
    Views:
    1,886
    Simon Brunning
    May 22, 2006
  4. Chris Spencer

    Re: [Py2exe-users] py2exe 0.6.9 released

    Chris Spencer, Nov 17, 2008, in forum: Python
    Replies:
    3
    Views:
    599
    Pascal
    Dec 8, 2008
  5. Mark Hammond

    RE: [Py2exe-users] py2exe 0.6.9 released

    Mark Hammond, Nov 17, 2008, in forum: Python
    Replies:
    0
    Views:
    479
    Mark Hammond
    Nov 17, 2008
Loading...

Share This Page