[Numpy-discussion] NumPy won't work with distutils loaded?

Dag Sverre Seljebotn dagss@student.matnat.uio...
Thu Jul 31 04:06:13 CDT 2008

While developing a testcase for NumPy in Cython, I had the problem 
demonstrated below. Essentially this means that I couldn't run testcases 
in our Cython testing framework (though I will work around it). Is this 
some known restriction in how NumPy can be used, is it work in progress, 
a problem with my environment/Ubuntu, or should I file a bug report?

This was on an up-to-date Ubunty Hardy 64-bit i386 system (with distro 
numpy, Python and distutils).

Py> import numpy

is ok, however (note the uppercase UnixCCompiler in dir(...)):

Py> import distutils.unixccompiler
Py> dir(distutils.unixccompiler)
['CCompiler', 'CompileError', 'DistutilsExecError', 'LibError', 
'LinkError', 'NoneType', 'StringType', 'UnixCCompiler', '__builtins__', 
'__doc__', '__file__', '__name__', '__revision__', 
'_darwin_compiler_fixup', 'copy', 'gen_lib_options', 
'gen_preprocess_options', 'log', 'newer', 'os', 'sys', 'sysconfig']
Py> import numpy
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/lib/python2.5/site-packages/numpy/__init__.py", line 37, 
in <module>
     import testing
   File "/usr/lib/python2.5/site-packages/numpy/testing/__init__.py", 
line 3, in <module>
     from numpytest import *
   File "/usr/lib/python2.5/site-packages/numpy/testing/numpytest.py", 
line 19, in <module>
     from numpy.distutils.exec_command import splitcmdline
   File "/usr/lib/python2.5/site-packages/numpy/distutils/__init__.py", 
line 6, in <module>
     import ccompiler
   File "/usr/lib/python2.5/site-packages/numpy/distutils/ccompiler.py", 
line 393, in <module>
     setattr(getattr(_m, _cc+'compiler'), 'gen_lib_options',
AttributeError: 'module' object has no attribute 'unixccompiler'

Dag Sverre

More information about the Numpy-discussion mailing list