On Mon, Jul 21, 2008 at 1:20 PM, Daniel Wheeler <[EMAIL PROTECTED]>
wrote:

>
> On Mon, Jul 21, 2008 at 11:02 AM, Zhiwen Liang <[EMAIL PROTECTED]>
> wrote:
> >>> "/sw/lib/python2.3/site-packages/matplotlib/numerix/_sp_imports.py",
> line 1,
> >>> in ?
> >>>    from numpy import Int8, UInt8, \
> >>> ImportError: cannot import name Int8
> >>
> >
> >  Regarding Daniel's question, I have the following output.
> > What happens when you do "python -c 'from numpy.oldnumeric import Int8'"?
> >
> > I can import Int8  this way.
>
> Paste the contents of
> "/sw/lib/python2.3/site-packages/matplotlib/numerix/_sp_imports.py" in
> an email.


The contents of the file is:

from numpy import Int8, UInt8, \
     Int16, UInt16, \
     Int32, UInt32, \
     Float32, Float64, \
     Complex32, Complex64, \
     Float, Int, Complex

class _TypeNamespace:
    """Numeric compatible type aliases for use with extension functions."""
    Int8          = Int8
    UInt8         = UInt8
    Int16         = Int16
    UInt16        = UInt16
    Int32         = Int32
    UInt32        = UInt32
    Float32       = Float32
    Float64       = Float64
    Complex32     = Complex32
    Complex64     = Complex64

nx = _TypeNamespace()

from numpy import inf, infty, Infinity
infinity = Infinity



> What version of matplotlib do you have? Look in
> "/sw/lib/python2.3/site-packages/matplotlib/__init__.py" and look for
> "__version__" to find out.
>

The version is 0.87.3.

I replaced the import part in the file _sp_import.py to be:

try:
    from numpy.oldnumeric import Int8, UInt8, \
         Int16, UInt16, \
         Int32, UInt32, \
         Float32, Float64, \
         Complex32, Complex64, \
         Float, Int, Complex
except ImportError:
    from numpy import Int8, UInt8, \
         Int16, UInt16, \
         Int32, UInt32, \
         Float32, Float64, \
         Complex32, Complex64, \
         Float, Int, Complex

Then I can get through this file. But there are a lot of other files that
need to be modified, i.e., replacing the numpy by numpy.oldnumeric. I guess
this matplotlib is just too old but I could not find a right version for it.
I think I will try to do it in another machine that use python2.4 or
python2.5. Or use other viewers to view the results.

Thank you very much for your times. I really appreciate it.

Zhiwen



>
> > What happens when you do "python -c 'from numpy import Int8'"?
> > The error is:
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> > ImportError: cannot import name Int8
> > What happens when you do "python -c 'import numpy; print
> > numpy.__version__'"?
> >
> > It is 1.0.1
>
>
> --
> Daniel Wheeler
>
>

Reply via email to