Opened 9 years ago
Last modified 5 years ago
#13083 new defect
Importing a specific module usually fails
Reported by: | poeschko | Owned by: | jason |
---|---|---|---|
Priority: | major | Milestone: | sage-6.9 |
Component: | misc | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
When I run sage --python
and then try to import something "specific" (e.g. from the rings
module), I get the following:
$ sage --python Python 2.7.2 (default, May 16 2012, 20:18:27) [GCC 4.6.3] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from sage.rings.all import * Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Applications/sage/local/lib/python2.7/site-packages/sage/rings/all.py", line 42, in <module> from ideal import Ideal, is_Ideal File "/Applications/sage/local/lib/python2.7/site-packages/sage/rings/ideal.py", line 35, in <module> from sage.interfaces.singular import singular as singular_default File "/Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/singular.py", line 340, in <module> import sage.rings.integer File "integer.pyx", line 170, in init sage.rings.integer (sage/rings/integer.c:35815) File "/Applications/sage/local/lib/python2.7/site-packages/sage/rings/infinity.py", line 200, in <module> import sage.rings.rational File "fast_arith.pxd", line 5, in init sage.rings.rational (sage/rings/rational.c:25959) File "fast_arith.pyx", line 51, in init sage.rings.fast_arith (sage/rings/fast_arith.c:7723) File "integer_ring.pyx", line 69, in init sage.rings.integer_ring (sage/rings/integer_ring.c:11304) File "/Applications/sage/local/lib/python2.7/site-packages/sage/structure/factorization.py", line 188, in <module> from sage.misc.all import prod File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/all.py", line 81, in <module> from functional import (additive_order, File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/functional.py", line 36, in <module> from sage.rings.complex_double import CDF File "complex_double.pyx", line 88, in init sage.rings.complex_double (sage/rings/complex_double.c:15160) File "real_mpfr.pxd", line 15, in init sage.rings.complex_number (sage/rings/complex_number.c:16587) File "real_mpfr.pyx", line 1, in init sage.rings.real_mpfr (sage/rings/real_mpfr.c:30314) File "utils.pyx", line 11, in init sage.libs.mpmath.utils (sage/libs/mpmath/utils.c:6099) File "/Applications/sage/local/lib/python2.7/site-packages/sage/all.py", line 72, in <module> from sage.libs.all import * File "/Applications/sage/local/lib/python2.7/site-packages/sage/libs/all.py", line 1, in <module> import sage.libs.ntl.all as ntl File "/Applications/sage/local/lib/python2.7/site-packages/sage/libs/ntl/__init__.py", line 1, in <module> import all File "/Applications/sage/local/lib/python2.7/site-packages/sage/libs/ntl/all.py", line 26, in <module> from sage.libs.ntl.ntl_ZZ import ( File "ntl_ZZ.pyx", line 28, in init sage.libs.ntl.ntl_ZZ (sage/libs/ntl/ntl_ZZ.cpp:6393) File "integer_ring.pyx", line 1062, in sage.rings.integer_ring.IntegerRing (sage/rings/integer_ring.c:9840) NameError: ZZ
This also happens for other modules, e.g. from sage.modules.all import *
. However, it does not occur when I do
from sage.all import *
first.
Change History (3)
comment:1 follow-up: ↓ 2 Changed 9 years ago by
comment:2 in reply to: ↑ 1 Changed 9 years ago by
Replying to mhansen:
Before you can do any of those specific imports, you need to do
import sage.allwhich will import things in the correct order and make sure everything is initialized. After that, you can import what you need.
I think this nevertheless witnesses some problems with Sage's imports and modularity. Is there a good reason why this shouldn't work ?
Florent
comment:3 Changed 5 years ago by
- Component changed from build to misc
- Description modified (diff)
- Milestone set to sage-6.9
- Owner changed from GeorgSWeber to jason
- Summary changed from Import fails in sage-python to Importing a specific module usually fails
Before you can do any of those specific imports, you need to do
which will import things in the correct order and make sure everything is initialized. After that, you can import what you need.