[Numpy-discussion] Re: Trouble installing numarray on Solaris

Todd Miller jmiller at stsci.edu
Mon Jul 4 17:27:54 EDT 2005


On Mon, 2005-07-04 at 18:59 +0200, Thomas Heller wrote:
> Todd Miller <jmiller at stsci.edu> writes:
> 
> > On Mon, 2005-07-04 at 13:40 +0200, Thomas Heller wrote:
> >> Todd Miller <jmiller at stsci.edu> writes:
> >> 
> >> > On Fri, 2005-07-01 at 15:02 -0700, Russell E. Owen wrote:
> >> >> A user of my application reports that installing numarray 1.3.2 on 
> >> >> Solaris using Python 2.3.1 has run into trouble:
> >> >> 
> >> >>   prompt> python
> >> >>   Python 2.3.1 (#1, Sep 30 2003, 20:29:58) [C] on sunos5
> >> >>   Type "help", "copyright", "credits" or "license" for more information.
> >> >>   >>> import numarray
> >> >>   Fatal Python error: Call to API function without first calling
> >> >>   import_libnumarray() in Src/_convmodule.c
> >> >>   Abort (core dumped)
> >> >
> >> > It looks vaguely like an binary API mismatch of some kind... or one of
> >> > you numarray modules is stale or broken.  To restate the obvious,   it's
> >> > likely that numarray won't import (in C!) because import_libnumarray()
> >> > is very defintely in _convmodule.c.  Since it's there and the API
> >> > pointer was not initialized,  the libnumarray import failed.
> >> 
> >> To the numarray authors/maintainers: Isn't it a bit harsh to call
> >> Py_FatalError() in the init function?
> >
> > That's an interesting observation...  the old recourse was to dump core
> > by calling through a NULL function pointer.  :-)
> >
> > Since this error can occur in the context of any API function, possibly
> > called from any sub-function within an extension function,  I'm not sure
> > there is a soft & general way to handle it:  getting it implies the
> > function must fail but that can't always be reported.  I'm open to
> > suggestions... it's just not obvious to me how to handle it better.
> 
> Maybe I was confusing numarray and numeric.  In numeric's
> _numpymodule.c, function init_numpy(), there is this
> 
>     [...]
>     if (PyErr_Occurred()) goto err;
>     return;
> err:
> 	Py_FatalError("can't initialize module _numpy");
> }
> 
> Sorry for the confusion.
> 
> > I've concluded that the message is overly specific and may shorten it to
> > just the facts:  "call through NULL numarray C-API pointer in <module>."
> 
> Wouldn't it be possible to raise an exception - that would make it
> easier to find the bug?

The two cases where this error have been triggered are:

1.  A bug in a C extension module which an author will catch before
release.  An exception is not worth much there.

2.  A corrupted numarray installation which will no longer import.  I
agree it would be nice there.

But... it's hard to raise an exception because the failure macro would
have to handle a variety of different return values,  even no return
value.  I don't see how to do it without too much extra complexity for a
relatively rare problem.

Regards,
Todd







More information about the NumPy-Discussion mailing list