[Numpy-discussion] Re: numpy with mod_python...

Robert Kern robert.kern at gmail.com
Thu Mar 9 13:47:02 CST 2006

Dav Clark wrote:
> So,
> This seems like an obvious thing, but there are so many levels of things 
> involved that I'd really appreciate some guidance.
> 'import numpy' works fine most places, but it strangely fails when done 
> from ../site-packages/numpy.  
> That, I don't care so much, but I found that problem in persuing why 'import 
> numpy' fails when called from a script within mod_python.  In this case, the 
> cwd is '/'.
> The precise error (in both cases) is:
> ---
> /usr/lib/python2.4/site-packages/numpy/core/__init__.py
>      20
>      21 __all__ = ['char','rec','memmap','ma']
> ---> 22 __all__ += numeric.__all__
>      23 __all__ += oldnumeric.__all__
>      24 __all__ += defmatrix.__all__
> NameError: name 'numeric' is not defined
> ---
> The obvious solution / hack to get this working in mod_python is to simply 
> os.chdir() before running an import.  Except that doesn't work.
> So, ideas about how to hack mod_python or numpy - or even better how to _fix_ 
> numpy - would be greatly appreciated!

Before you import numpy, what is your sys.path? Where is numpy/? What files are
in numpy/core/? What version of numpy are you using?

Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the Numpy-discussion mailing list