[Numpy-discussion] numpy quit working

Robert Kern robert.kern@gmail....
Wed Jan 16 12:01:13 CST 2008


Kevin Christman wrote:
> I've started to use numpy (1.0.4) and matplotlib but it suddenly quit working.  Now when I import a simple test script:
> import numpy
> numpy.linspace(0,1)
> 
> it gives the following error:
> 
> Traceback (most recent call last):
>   File "D:/anothertest.py", line 1, in <module>
>     import numpy
>   File "C:\Python25\lib\site-packages\numpy\__init__.py", line 37, in <module>
>     import testing
>   File "C:\Python25\lib\site-packages\numpy\testing\__init__.py", line 3, in <module>
>     from numpytest import *
>   File "C:\Python25\lib\site-packages\numpy\testing\numpytest.py", line 19, in <module>
>     from numpy.distutils.exec_command import splitcmdline
>   File "C:\Python25\lib\site-packages\numpy\distutils\__init__.py", line 6, in <module>
>     import ccompiler
>   File "C:\Python25\lib\site-packages\numpy\distutils\ccompiler.py", line 46, in <module>
>     replace_method(CCompiler, 'spawn', CCompiler_spawn)
>   File "C:\Python25\lib\site-packages\numpy\distutils\ccompiler.py", line 24, in replace_method
>     m = new.instancemethod(func, None, klass)
> AttributeError: 'module' object has no attribute 'instancemethod'
> 
> However, other import statements, like "import time" work ok.
> The problem first started when a script would only run if on the root of the drive (e.g. D:\), but now even if I run it from there it doesn't work. What's going on?

Do you have a module called new.py somewhere? If so, then it is overriding the 
standard library's "new" module which we use.

 >>> import new
 >>> new
<module 'new' from 'C:\Python25\lib\new.pyc'>

If that filename does not point to 'C:\Python25\lib\new.pyc', then you have a 
problem.

-- 
Robert Kern

"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