[Numpy-discussion] problem with numpy.distutils and Cython

Robert Kern robert.kern@gmail....
Sun Aug 23 02:34:17 CDT 2009


On Sun, Aug 23, 2009 at 00:27, Nicolas Pinto<nicolas.pinto@gmail.com> wrote:
> Hello,
>
> I'm trying to use numpy.distutils and Cython in a setup.py but I'm running
> into some problems.
>
> The following code raises a "AttributeError: fcompiler" when I run "python
> setup.py install" (it runs smoothly with "python setup.py build_ext
> --inplace"):
>
> from numpy.distutils.core import setup, Extension
> from Cython.Distutils import build_ext
> ext_modules = [Extension("test", ["test.pyx"])]
> setup(cmdclass = {'build_ext': build_ext}, ext_modules = ext_modules)
>
> Whereas the following works in both cases:
>
> from distutils.core import setup, Extension
> from Cython.Distutils import build_ext
> ext_modules = [Extension("test", ["test.pyx"])]
> setup(cmdclass = {'build_ext': build_ext}, ext_modules = ext_modules)
>
> Am I missing something?

numpy.distutils needs its own build_ext, which you are overriding with
Cython's. You need one build_ext that does both things.

-- 
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