[SciPy-dev] scipy import failures, what can we do about it?

Pearu Peterson pearu at cens.ioc.ee
Tue Feb 26 14:04:54 CST 2002


On Tue, 26 Feb 2002, Travis Oliphant wrote:

> > Hi,
> >
> > I have several times noticed that if scipy import fails then it shows
> > 1) unrelated error messages and 2) the corresponding message of the true
> > reason of the failure is either hidden or presented in an unnoticable
> > way. The following message illustrates a particular case of all that:
> 
> I'm not sure of the solution, but it would probably help to wrap the
> import statements (particularly the ones based on compiled modules) in try
> except clauses so that a more helpful error message could be raised.

Ok, this would be helpful in cases where importing of, say, clapack
fails, then instead of showing plain messages with missing symbols, a
message something like 'fix your atlas installation' is shown.

But I am not sure that this will fix the scipy importing failure messages,
what you get is just a replaced failure message and there will be
still alien failure messages.

I don't understand the purpose of functions like modules2all,
names2all, etc. For example, why linalg.__init__.py contains

  _modules = ['fblas', 'flapack', 'cblas', 'clapack']
  _namespaces = ['linear_algebra']
  __all__ = []
  import scipy
  scipy.modules2all(__all__, _modules, globals())
  scipy.names2all(__all__, _namespaces, globals())

instead of plain and explicit

  from linear_algebra import __all__
  from linear_algebra import *

And if scipy/__init__.py has

  from linalg import *

then doing 'import scipy', the failure of importing clapack would
raise an exception showing a direct location of the problem.

Sorry, if I don't understand the big picture of scipy structure, I have
always thought that keeping modules independent would be a good thing but
current scipy hooks seem to try to integrate all modules and their
namespaces into a one big one. I must be missing something obvious...
Could someone direct me into the right path here if possible?

Thanks,
	Pearu




More information about the Scipy-dev mailing list