[Numpy-discussion] Use of numarray from numpy package [# INC NO 24609]

Andrew Straw strawman at astraw.com
Wed Aug 30 12:13:16 EDT 2006


LANDRIU David SAp wrote:
> Hello,
>   
>   I come back to my question : how to use numarray 
>  with the numpy installation ? 
>   
> {ccali22}~(0)>setenv PYTHONPATH /usr/local/lib/python2.3/site-packages/numpy
>   
Here's where you went wrong. You want:

setenv PYTHONPATH /usr/local/lib/python2.3/site-packages

> {ccali22}~(0)>python
> Python 2.3.5 (#2, Oct 17 2005, 17:20:02)
> [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-52)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>   
>>>> from numarray import *
>>>>         
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/local/lib/python2.3/site-packages/numpy/numarray/__init__.py", line 1, in ?
>     from util import *
>   File "/usr/local/lib/python2.3/site-packages/numpy/numarray/util.py", line 2, in ?
>     from numpy import geterr
> ImportError: No module named numpy
>   

Note that you're actually importing a numarray within numpy's directory
structure. That's because of your PYTHONPATH. numpy ships numpy.numarray
to provide backwards compatibility. To use it, you must do "import
numpy.numarray as numarray"

Cheers!
Andrew




More information about the NumPy-Discussion mailing list