[Numpy-discussion] numpy.linalg prevents use of scipy.linalg?
Zachary Pincus
zpincus at stanford.edu
Fri Mar 3 17:29:16 EST 2006
Hi folks,
I can't seem to use any of the functions in scipy.linalg because
numpy defines its own linalg which shadows that of scipy!
Specifically, scipy.linalg defines 'norm' (in linalg/basic.py), and
numpy doesn't. (This among other differences, I assume.)
In [1]: import scipy
In [2]: scipy.linalg.norm
AttributeError: 'module' object has no attribute 'norm'
In [3]: scipy.linalg.__file__
Out[3]: '[...]/python2.4/site-packages/numpy/linalg/__init__.pyc'
^^^^^^^
Now, look what happens when we import scipy.linalg directly:
In [1]: import scipy.linalg
In [2]: scipy.linalg.norm
Out[2]: <function norm at 0x14261f0>
In [3]: scipy.linalg.__file__
Out[3]: '[...]/python2.4/site-packages/scipy/linalg/__init__.pyc'
^^^^^^^
Something needs to be done to fix this -- but what? Scipy
historically imports * from numpy. Scipy historically has a linalg
module. The new thing is that numpy has a linalg module, too, which
is loaded by default into the numpy namespace. (Compared to Numeric's
LinearAlgebra module.)
The only thing I can think of is to fold all of scipy.linalg into
numpy.linalg, and remove the former. This provides for backwards
compatibility for everyone, but perhaps a bit of work.
Zach
More information about the NumPy-Discussion
mailing list