[Numpy-discussion] problem with numpy.distutils and Cython
Nicolas Pinto
pinto@mit....
Sun Sep 6 18:38:57 CDT 2009
Thanks Lisandro, it worked perfectly!
On Sun, Aug 23, 2009 at 6:30 PM, Lisandro Dalcin <dalcinl@gmail.com> wrote:
> The monkeypatching below in your setup.py could work. This way, you
> just have to use numpy.distutils, but you will not be able to pass
> many options to Cython (like C++ code generation?)
>
> from numpy.distutils.command import build_src
> import Cython
> import Cython.Compiler.Main
> build_src.Pyrex = Cython
> build_src.have_pyrex = True
>
>
> On Sun, Aug 23, 2009 at 4:34 AM, Robert Kern<robert.kern@gmail.com> wrote:
> > 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
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
>
>
>
> --
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
--
Nicolas Pinto
Ph.D. Candidate, Brain & Computer Sciences
Massachusetts Institute of Technology, USA
http://web.mit.edu/pinto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090906/49cc0d18/attachment.html
More information about the NumPy-Discussion
mailing list