Hello everyone: 

After some poking around (and hat tip from Marc Masdeu), I notice that the 
source for the error might be in part due to the following: 


[knsam@gl-login1 magma]$ echo $SAGE_ROOT
/sw/lsa/centos7/sage/9.1

For some reason, sage is looking in $SAGE_ROOT/lib/sage/ext_data/magma/ and 
from what I can see, in my installation, there is no such thing. However, I 
do notice that the file containing the commands that would make this run 
namely basic.m is in 

$SAGE_ROOT/lib/python3.7/site-packages/sage/ext_data/magma/

Does this mean that I should somehow recompile sage with a different 
SAGE_ROOT, or teach Sage to look here instead when it wants to fool around 
with magma? Any help fixing it would be appreciated. Thank you! 
On Wednesday, August 26, 2020 at 12:15:44 PM UTC-4 Kannappan Sampath wrote:

> Hello everyone: 
>
> I am trying to compute with Eichler orders in a definite quaternion 
> algebra and consequently would like for Sage and Magma to talk to each 
> other.  I am using Sage version 9.1 and Magma version V2.25-2. I think that 
> Sage is able to discover the Magma installation (eg. magma_console() 
> works). 
>
> However, in my installation, somehow many of the basic Sage<->Magma 
> interface commands are broken. For example: 
>
> sage: magma(*1*).sage()
>
> ---------------------------------------------------------------------------
>
> RuntimeError                              Traceback (most recent call 
> last)
>
> <ipython-input-26-1c79c0c0379c> in <module>()
>
> ----> 1 magma(Integer(1)).sage()
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/interface.py
>  
> in sage(self, *args, **kwds)
>
> *   1085*             [0 0]
>
> *   1086*         """
>
> -> 1087         return self._sage_(*args, **kwds)
>
> *   1088* 
>
> *   1089*     def __repr__(self):
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in _sage_(self)
>
> *   2062*             Ring of integers modulo 137
>
> *   2063*         """
>
> -> 2064         z, preparse = self.Sage(nvals=2)
>
> *   2065*         s = str(z)
>
> *   2066*         preparse = str(preparse) == 'true'
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in __call__(self, *args, **kwds)
>
> *   1680*                                [self._obj.name()] + list(args),
>
> *   1681*                                params=kwds,
>
> -> 1682                                nvals=nvals)
>
> *   1683* 
>
> *   1684*     def _instancedoc_(self):
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in function_call(self, function, args, params, nvals)
>
> *   1163*         fun = "%s(%s%s)" % (function, ",".join([s.name() for s 
> in args]), par)
>
> *   1164* 
>
> -> 1165         return self._do_call(fun, nvals)
>
> *   1166* 
>
> *   1167*     def _do_call(self, code, nvals):
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in _do_call(self, code, nvals)
>
> *   1218*             vars = ", ".join(v)
>
> *   1219*             cmd = "%s := %s;" % (vars, code)
>
> -> 1220             out = self.eval(cmd)
>
> *   1221*             ans = tuple([MagmaElement(self, x, is_name=True) for 
> x in v])
>
> *   1222* 
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in eval(self, x, strip, **kwds)
>
> *    561*         ans = Expect.eval(self, x, **kwds).replace('\\\n', '')
>
> *    562*         if 'Runtime error' in ans or 'User error' in ans:
>
> --> 563             raise RuntimeError("Error evaluating Magma 
> code.\nIN:%s\nOUT:%s" % (x, ans))
>
> *    564*         return ans
>
> *    565* 
>
>
> RuntimeError: Error evaluating Magma code.
>
> IN:_sage_[33], _sage_[16] := Sage(_sage_[24]);
>
> OUT:
>
> >> _sage_[33], _sage_[16] := Sage(_sage_[24]);
>
>                              ^
>
> User error: Identifier 'Sage' has not been declared or assigned
>
>
> sage: R.<y> = PolynomialRing(QQ)
>
> sage: S = magma(R)
>
> ---------------------------------------------------------------------------
>
> RuntimeError                              Traceback (most recent call 
> last)
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/expect.py
>  
> in __init__(self, parent, value, is_name, name)
>
> *   1470*             try:
>
> -> 1471                 self._name = parent._create(value, name=name)
>
> *   1472*             # Convert ValueError and RuntimeError to TypeError 
> for
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/interface.py
>  
> in _create(self, value, name)
>
> *    501*         name = self._next_var_name() if name is None else name
>
> --> 502         self.set(name, value)
>
> *    503*         return name
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in set(self, var, value)
>
> *    628*         """
>
> --> 629         out = self.eval("%s:=%s" % (var, value))
>
> *    630*         if out.lower().find("error") != -1:
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in eval(self, x, strip, **kwds)
>
> *    562*         if 'Runtime error' in ans or 'User error' in ans:
>
> --> 563             raise RuntimeError("Error evaluating Magma 
> code.\nIN:%s\nOUT:%s" % (x, ans))
>
> *    564*         return ans
>
>
> RuntimeError: Error evaluating Magma code.
>
> IN:_sage_[17]:=SageCreateWithNames(PolynomialRing(_sage_ref2),["y"]);
>
> OUT:
>
> >> _sage_[17]:=SageCreateWithNames(PolynomialRing(_sage_ref2),["y"]);
>
>                ^
>
> User error: Identifier 'SageCreateWithNames' has not been declared or 
> assigned
>
>
> During handling of the above exception, another exception occurred:
>
>
> TypeError                                 Traceback (most recent call 
> last)
>
> <ipython-input-28-a5ee0ecd878c> in <module>()
>
> ----> 1 S = magma(R)
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in __call__(self, x, gens)
>
> *    792*             pass
>
> *    793* 
>
> --> 794         A = Expect.__call__(self, x)
>
> *    795*         if has_cache:
>
> *    796*             x._magma_cache[self] = A
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/interface.py
>  
> in __call__(self, x, name)
>
> *    302*             # user-assigned name might change its value, so we 
> return a
>
> *    303*             # new element.
>
> --> 304             result = self._coerce_from_special_method(x)
>
> *    305*             return result if name is None else result.name(
> new_name=name)
>
> *    306*         except TypeError:
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in _coerce_from_special_method(self, x)
>
> *    831*         """
>
> *    832*         s = x._magma_init_(self)
>
> --> 833         a = self(s)
>
> *    834* 
>
> *    835*         # dereference all _sage_ref's used in this string.
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in __call__(self, x, gens)
>
> *    792*             pass
>
> *    793* 
>
> --> 794         A = Expect.__call__(self, x)
>
> *    795*         if has_cache:
>
> *    796*             x._magma_cache[self] = A
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/interface.py
>  
> in __call__(self, x, name)
>
> *    295* 
>
> *    296*         if isinstance(x, string_types):
>
> --> 297             return cls(self, x, name=name)
>
> *    298*         try:
>
> *    299*             # Special methods do not and should not have an 
> option to
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/expect.py
>  
> in __init__(self, parent, value, is_name, name)
>
> *   1474*             except (RuntimeError, ValueError) as x:
>
> *   1475*                 self._session_number = -1
>
> -> 1476                 raise_(TypeError, TypeError(*x.args), sys.exc_info
> ()[2])
>
> *   1477*             except BaseException:
>
> *   1478*                 self._session_number = -1
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/six.py in reraise(tp, 
> value, tb)
>
> *    690*                 value = tp()
>
> *    691*             if value.__traceback__ is not tb:
>
> --> 692                 raise value.with_traceback(tb)
>
> *    693*             raise value
>
> *    694*         finally:
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/expect.py
>  
> in __init__(self, parent, value, is_name, name)
>
> *   1469*         else:
>
> *   1470*             try:
>
> -> 1471                 self._name = parent._create(value, name=name)
>
> *   1472*             # Convert ValueError and RuntimeError to TypeError 
> for
>
> *   1473*             # coercion to work properly.
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/interface.py
>  
> in _create(self, value, name)
>
> *    500*     def _create(self, value, name=None):
>
> *    501*         name = self._next_var_name() if name is None else name
>
> --> 502         self.set(name, value)
>
> *    503*         return name
>
> *    504* 
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in set(self, var, value)
>
> *    627*             13/5
>
> *    628*         """
>
> --> 629         out = self.eval("%s:=%s" % (var, value))
>
> *    630*         if out.lower().find("error") != -1:
>
> *    631*             raise TypeError("Error executing Magma code:\n%s" % 
> out)
>
>
>
> /sw/lsa/centos7/sage/9.1/lib/python3.7/site-packages/sage/interfaces/magma.py 
> in eval(self, x, strip, **kwds)
>
> *    561*         ans = Expect.eval(self, x, **kwds).replace('\\\n', '')
>
> *    562*         if 'Runtime error' in ans or 'User error' in ans:
>
> --> 563             raise RuntimeError("Error evaluating Magma 
> code.\nIN:%s\nOUT:%s" % (x, ans))
>
> *    564*         return ans
>
> *    565* 
>
>
> TypeError: Error evaluating Magma code.
>
> IN:_sage_[17]:=SageCreateWithNames(PolynomialRing(_sage_ref2),["y"]);
>
> OUT:
>
> >> _sage_[17]:=SageCreateWithNames(PolynomialRing(_sage_ref2),["y"]);
>
>                ^
>
> User error: Identifier 'SageCreateWithNames' has not been declared or 
> assigned
>
>
> Any ideas about how to debug the problem would be much appreciated. 
>
>                                        Best, 
>                                        Kannappan 
>
>
> ---------
> *Kannappan Sampath*
> *Graduate Student*
>
> Department of Mathematics | University of Michigan
> kn...@umich.edu
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/2cf101be-f455-4bbb-91f2-2a8b0f8dc7ccn%40googlegroups.com.

Reply via email to