[Numpy-discussion] ANN: NumPy 1.7.0b1 release

Orion Poplawski orion@cora.nwra....
Wed Aug 22 10:55:59 CDT 2012


On 08/21/2012 10:24 AM, Ondřej Čertík wrote:
> Hi,
>
> I'm pleased to announce the availability of the first beta release of
> NumPy 1.7.0b1.

Currently in trying to support python 3.3 in Fedora Rawhide (F19) and Fedora 
18 we are doing:

# Regenerate Cython c sources
# This is needed with numpy-1.6.2.tar.gz with python 3.3 to avoid an exception
# with an import call in the generated .c file in the tarball that uses the
# old default of -1:
#     File "mtrand.pyx", line 126, in init mtrand 
(numpy/random/mtrand/mtrand.c:20679)
#   ValueError: level must be >= 0
# due to the changes in import in 3.3
# Regenerating with a newer Cython fixes it:
pushd numpy/random/mtrand/
rm -v mtrand.c
cython mtrand.pyx
popd

However with 1.7.0b1 and Cython 0.16 we get:

+ cython mtrand.pyx
Error compiling Cython file:
------------------------------------------------------------
...
                 PyArray_DIMS(oa) , NPY_DOUBLE)
         length = PyArray_SIZE(array)
         array_data = <double *>PyArray_DATA(array)
         itera = <flatiter>PyArray_IterNew(<object>oa)
         for i from 0 <= i < length:
             array_data[i] = func(state, (<double *>(itera.dataptr))[0])
                                         ^
------------------------------------------------------------
mtrand.pyx:177:41: Python objects cannot be cast to pointers of primitive types
Error compiling Cython file:
------------------------------------------------------------
...
     cdef npy_intp i
     cdef broadcast multi
     if size is None:
         multi = <broadcast> PyArray_MultiIterNew(2, <void *>oa, <void *>ob)
         array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, 
NPY_DOUBLE)
                                                           ^
------------------------------------------------------------
mtrand.pyx:222:59: Cannot convert Python object to 'npy_intp *'
Error compiling Cython file:
------------------------------------------------------------
...
     cdef npy_intp i
     cdef broadcast multi
     if size is None:
         multi = <broadcast> PyArray_MultiIterNew(3, <void *>oa, <void *>ob, 
<void *>oc)
         array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, 
NPY_DOUBLE)
                                                           ^
------------------------------------------------------------
mtrand.pyx:275:59: Cannot convert Python object to 'npy_intp *'
Error compiling Cython file:
------------------------------------------------------------
...
     cdef long *on_data
     cdef broadcast multi
     if size is None:
         multi = <broadcast> PyArray_MultiIterNew(2, <void *>on, <void *>op)
         array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG)
                                                           ^
------------------------------------------------------------
mtrand.pyx:341:59: Cannot convert Python object to 'npy_intp *'
Error compiling Cython file:
------------------------------------------------------------
...
     cdef double *on_data
     cdef broadcast multi
     if size is None:
         multi = <broadcast> PyArray_MultiIterNew(2, <void *>on, <void *>op)
         array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG)
                                                           ^
------------------------------------------------------------
mtrand.pyx:390:59: Cannot convert Python object to 'npy_intp *'
Error compiling Cython file:
------------------------------------------------------------
...
     cdef npy_intp i
     cdef broadcast multi
     if size is None:
         multi = <broadcast> PyArray_MultiIterNew(3, <void *>on, <void *>om, 
<void *>oN)
         array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG)
                                                           ^
------------------------------------------------------------
mtrand.pyx:442:59: Cannot convert Python object to 'npy_intp *'
Error compiling Cython file:
------------------------------------------------------------
...
                 PyArray_DIMS(oa), NPY_LONG)
         length = PyArray_SIZE(array)
         array_data = <long *>PyArray_DATA(array)
         itera = <flatiter>PyArray_IterNew(<object>oa)
         for i from 0 <= i < length:
             array_data[i] = func(state, (<double *>(itera.dataptr))[0])
                                         ^
------------------------------------------------------------
mtrand.pyx:498:41: Python objects cannot be cast to pointers of primitive types
Error compiling Cython file:
------------------------------------------------------------
...
         flow = PyFloat_AsDouble(low)
         fhigh = PyFloat_AsDouble(high)
         if not PyErr_Occurred():
             return cont2_array_sc(self.internal_state, rk_uniform, size, 
flow, fhigh-flow)
         PyErr_Clear()
         olow = <ndarray>PyArray_FROM_OTF(low, NPY_DOUBLE, NPY_ARRAY_ALIGNED)
                                                                           ^
------------------------------------------------------------
mtrand.pyx:1140:75: undeclared name not builtin: NPY_ARRAY_ALIGNED



I'm afraid I know nothing about Cython.  Looks like there were a lot of 
changes between 1.6.2 and 1.7.0b1 in mtrand.pyx.  I'll try not rebuilding and 
see if we see the original problem.


-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder Office                  FAX: 303-415-9702
3380 Mitchell Lane                       orion@nwra.com
Boulder, CO 80301                   http://www.nwra.com


More information about the NumPy-Discussion mailing list