Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error when trying to import without sage.all

I am trying to import only the Sage functions needed as is done in the Sage source code, but I am running into issues. For example, (running sage -python),

>>> from sage.groups.group import Group

results in

...
from sage.rings.complex_double import CDF
File "sage/rings/real_double.pxd", line 8, in init sage.rings.complex_double (/export/pkgs/linux-rh6/sagemath-7.0/src/build/cythonized/sage/rings/complex_double.c:22654)
File "sage/rings/real_double.pyx", line 64, in init sage.rings.real_double (/export/pkgs/linux-rh6/sagemath-7.0/src/build/cythonized/sage/rings/real_double.c:25060)
ImportError: cannot import name ZZ

(I can post the full traceback if that would be helpful.) Similar things happen for almost any import I try. I was using the import_statements to determine what to import.

Am I missing something?

Error when trying to import without sage.all

I am trying to import only the Sage functions needed as is done in the Sage source code, but I am running into issues. For example, (running sage -python),

>>> from sage.groups.group import Group

results in

...
from sage.rings.complex_double import CDF
File "sage/rings/real_double.pxd", line 8, in init sage.rings.complex_double (/export/pkgs/linux-rh6/sagemath-7.0/src/build/cythonized/sage/rings/complex_double.c:22654)
File "sage/rings/real_double.pyx", line 64, in init sage.rings.real_double (/export/pkgs/linux-rh6/sagemath-7.0/src/build/cythonized/sage/rings/real_double.c:25060)
ImportError: cannot import name ZZ

(I can post the full traceback if that would be helpful.) Similar things happen for almost any import I try. I was using the import_statements to determine what to import.

Am I missing something?

EDIT:

I think I get the picture a little better now. The Sage source files aren't meant to be imported in Python, they are meant to be imported into Sage, which presumably runs import sage.all when it starts.