Dag Sverre Seljebotn wrote: > Jason Grout wrote: >> ghtdak wrote: >>> >>> On Jun 7, 11:29 am, Dag Sverre Seljebotn <da...@student.matnat.uio.no> >>> wrote: >>>> Glenn Tarbox, PhD wrote: >>>>> setup.py is pulled directly from the cython tutorial docs: >>>>> tar...@puget:$ cat setup.py >>>>> from distutils.core import setup >>>>> from distutils.extension import Extension >>>>> from Cython.Distutils import build_ext >>>>> setup( >>>>> cmdclass = {'build_ext': build_ext}, >>>>> ext_modules = [Extension("testnumpy", ["testnumpy.pyx"])] >>>>> ) >>>>> The numpy include directories were problematic previously (an extra >>>>> "core" directory level recently introduced) although Trac indicates >>>>> that issue was fixed and I'm "pretty sure" I first saw the include >>>>> problem in the notebook which doesn't occur. >>>> Note that that setup.py doesn't include NumPy headers, which are >>>> usually >>>> needed if numpy is cimported. Please do >>>> >>>> import numpy >>>> ... >>>> setup( >>>> ... >>>> ext_modules = [Extension(..., include_path=[numpy.get_include()])] >>>> ) >>>> >>> >>> cool. a little reading / poking around and came up with: >>> >>> >>> tar...@puget:$ cat setup.py >>> from distutils.core import setup >>> from distutils.extension import Extension >>> from Cython.Distutils import build_ext >>> import numpy >>> >>> setup( >>> cmdclass = {'build_ext': build_ext}, >>> ext_modules = [Extension("testnumpy", >>> ["testnumpy.pyx"],include_dirs=[numpy.get_include()])] >>> ) >> >> I thought #6053 fixed the notebook numpy issue. Is there more to the >> issue than what is done there? Are the tests above being done on 4.0 >> (e.g., sagenb.org)? >> >> >> The following works fine on sage 4.0 (e.g., sagenb.org): >> >> %cython >> cimport numpy as np >> import numpy as np >> DTYPE = np.int >> ctypedef np.npy_intp DTYPE_t >> >> Note that I had to change the ctypedef. There is no int_t defined in >> the numpy.pxd file (devel/sage/sage/ext/numpy.pxd). Should there be >> an np.int_t type? > > Hmm. Strange. Do you use the numpy.pxd shipped with Cython? You should > -- it evolves together with features in Cython, while the one shipping > with NumPy itself contains no support for things that has been going on > beyond Pyrex. > > int_t should be in there, see e.g. > > http://hg.cython.org/cython-devel/file/51fa7e425dc8/Cython/Includes/numpy.pxd#l260 > > > > IIRC it's been there since the beginning. >
Note that the numpy.pxd that ships with Python is in the default Cython include path -- so I'd expect simply removing sage/sage/ext/numpy.pxd to resolve the issue. Sorry that I haven't got time now to test this myself. -- Dag Sverre --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---