Importing Sage functions into Cython?

asked 2018-05-06 23:14:53 -0500

tuna gravatar image

I am trying to define variables in Cython part of my code like this

a,b,c = var('a,b,c')

But in this line I cant import var() function from Sage

from sage.calculus.var import var

I got this error:

$ sage -python  real_sage.sage
Compiling ./real_sage.spyx...
Traceback (most recent call last):
  File "real_sage.sage", line 6, in <module>
    from real_sage import foo
  File "real_sage.pyx", line 10, in init real_sage
  File "sage/calculus/var.pyx", line 6, in init sage.calculus.var
  File "/home/tunamustafakemal/sega/SageMath/local/lib/python2.7/site-packages/sage/symbolic/function_factory.py", line 15, in <module>
    from sage.symbolic.function import SymbolicFunction, sfunctions_funcs, \
  File "sage/rings/integer.pxd", line 7, in init sage.symbolic.function
  File "sage/rings/rational.pxd", line 8, in init sage.rings.integer
  File "sage/rings/rational.pyx", line 89, in init sage.rings.rational
  File "sage/rings/real_mpfr.pyx", line 1, in init sage.rings.real_mpfr
  File "sage/rings/complex_number.pxd", line 6, in init sage.libs.mpmath.utils
  File "sage/rings/complex_double.pxd", line 10, in init sage.rings.complex_number
  File "sage/rings/complex_double.pyx", line 94, in init sage.rings.complex_double
ImportError: cannot import name complex_number

Thanks for any support.

edit retag flag offensive close merge delete

Comments

FrédéricC gravatar imageFrédéricC ( 2018-05-11 14:21:46 -0500 )edit