The tickets: http://trac.sagemath.org/sage_trac/ticket/4571 and  
http://trac.cython.org/cython_trac/ticket/339 . Also, http:// 
trac.sagemath.org/sage_trac/ticket/6438 to support complex numbers in  
Sage.

- Robert


On Jun 7, 2009, at 7:34 AM, Glenn Tarbox, PhD wrote:

> This has become a two part question / issue:
> The use of Cython / Numpy in the notebook
> The use of Cython / Numpy on the command line
> Cython itself seems to work fine with the "Hello World" example, so  
> the core installation is consistent with the base cython package  
> (at least with my admittedly trivial tests)
>
> Using Cython with Numpy, however, doesn't appear to work "outta the  
> box"
>
> First, I tried the following in the notebook:
>
> %cython
> import numpy as np
> cimport numpy as np
> DTYPE = np.int
> ctypedef np.int_t DTYPE_t
>
> Here's the error:
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Traceback (most recent call last): cimport numpy as np
> File "/mnt/hdd/sage/sage-4.0.1/local/lib/python2.5/site-packages/ 
> sage/server/support.py", line 408, in cython_import_all
> create_local_c_file=create_local_c_file)
> File "/mnt/hdd/sage/sage-4.0.1/local/lib/python2.5/site-packages/ 
> sage/server/support.py", line 385, in cython_import
> create_local_c_file=create_local_c_file)
> File "/mnt/hdd/sage/sage-4.0.1/local/lib/python2.5/site-packages/ 
> sage/misc/cython.py", line 367, in cython
> raise RuntimeError, "Error converting %s to C:\n%s\n%s"%(filename,  
> log, err)
> RuntimeError: Error converting /home/tarbox/.sage/sage_notebook/ 
> worksheets/admin/89/code/sage4.spyx to C:
>
>
> Error converting Pyrex file to C:
> ------------------------------------------------------------
> ...
> include "cdefs.pxi"
> #from __future__ import division
> import numpy as np
> cimport numpy as np
> DTYPE = np.int
> ctypedef np.int_t DTYPE_t ^
> ------------------------------------------------------------
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> I posted a question to the cython-dev list and Dag suggested trying  
> a straight Cythonize first...
>
> Trying an equivalent Cython NumPy test file yields the following  
> error:
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> tar...@tarbox-laptop:$ python setup.py build_ext --inplace
> running build_ext
> building 'testnumpy' extension
> gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict- 
> prototypes -fPIC -I/home/tarbox/projects/sage/sage-4.0.1/local/ 
> include/python2.5 -c testnumpy.c -o build/temp.linux-i686-2.5/ 
> testnumpy.o
> testnumpy.c:133:31: error: numpy/arrayobject.h: No such file or  
> directory
> testnumpy.c:390: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or  
> ‘__attribute__’ before ‘__pyx_t_5numpy_int8_t’
>
> etc.... (usual big spew after an include file isn't found and every  
> symbol isn't found)
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
>
> 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.
>
> It appears that the include fix might not be general the command  
> line is throwing a similar error to what I believe I saw in earlier  
> (<=4.0) versions of Sage.
>
> I'll put a ticket up on Trac but wanted to make sure I'm not just  
> being dense or if there are other scripts I should be using.
>
> -glenn
>
> -- 
> Glenn H. Tarbox, PhD ||  206-274-6919
> http://www.tarbox.org
>
> >


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

Reply via email to