[Numpy-discussion] Re: Error involving import_libnumarray in packaged program

Thomas Heller theller at python.net
Thu Oct 13 10:44:46 EDT 2005

"Russell E. Owen" <rowen at cesmail.net> writes:

> In article <434BE46E.6090000 at stsci.edu>,
>  Todd Miller <jmiller at stsci.edu> wrote:
>> Russell E. Owen wrote:
>> >If I convert my python code to an application (Windows via py2exe or Mac 
>> >via bundlebuilder) it fails with the following error:
>> >
>> >Fatal Python error: Call to API function without first calling 
>> >import_libnumarray() in Src/_convmodule.c
>> >I can force *all* of numarray into the application, which avoids the 
>> Unfortunately,  I think it's just necessary to (a) include all of core 
>> numarray and (b) help out automated tools (which choke on circular 
>> dependencies) by explicitly listing numarray's core extensions.  
> Is there some practical way to include all of core numarray (without 
> getting the unused extensions)?
> Could "import numarray" itself do the importing of core numarray? Then 
> automatic packaging tools would "just work".

The easiest way to build some 'hints' for those packaging tools that use
modulefinder is to create a silly function that imports everything
belonging to the package:

def _give_py2exe_hints():
    import this
    import that

Note that it will NOT work to write this:

if 0:
    import this
    import that

because 'if 0' blocks are optimized away completely by the Python
This should be in numarray's __init__.py file, probably.


More information about the NumPy-Discussion mailing list