Error involving import_libnumarray in packaged program
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 issue. But that is overkill. Is there some simpler way to solve this, e.g. some an import or command in my code that will prevent this from happening? -- Russell
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
This currently (1.3.3) happens when a numarray API function is called before the API is successfully initialized. Although the message was intended as an aid to extension writers, in this case numarray is failing to import altogether. At one point numarray had a fatal error for import failures but I removed it at someone's request. I've restored it because I think it's most commonly fatal anyway and removing the message just obfuscated the problem. The non-fatal behavior is now in the _import_libnumarray() macro.
I can force *all* of numarray into the application, which avoids the
This is what you need to do. It should be possible to factor out (or not explicitly list) numarray's Packages, but core numarray is not meant to be distributed in pieces. The many type-specific extensions were only added to work around a compiler problem, not to lighten binary distributions.
issue. But that is overkill. Is there some simpler way to solve this,
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. Regards, Todd
In article <434BE46E.6090000@stsci.edu>,
Todd Miller
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". -- Russell
"Russell E. Owen"
In article <434BE46E.6090000@stsci.edu>, Todd Miller
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 compiler. This should be in numarray's __init__.py file, probably. Thomas
participants (3)
-
Russell E. Owen
-
Thomas Heller
-
Todd Miller