Ask Your Question

upgrade to sage 8.6

asked 2019-03-16 17:03:33 +0200

stockh0lm gravatar image

updated 2019-03-16 17:04:38 +0200

When running a sage file on the command line i get an error since i upgraded sage to SageMath version 8.6, Release Date: 2019-01-15, on my debian box.

> cat /etc/debian_version

this used to work before, when i used the sagemath package from stable, but now i get a python traceback:

 > sage Fehlerrechnung-2019-02-19-085035.sage
Traceback (most recent call last):
  File "", line 3, in <module>
    from sage.all_cmdline import *   # import sage library
  File "/usr/lib/python2.7/dist-packages/sage/", line 26, in <module>
    from sage.all import *
  File "/usr/lib/python2.7/dist-packages/sage/", line 83, in <module>
    from sage.misc.all       import *         # takes a while
  File "/usr/lib/python2.7/dist-packages/sage/misc/", line 84, in <module>
    from .functional import (additive_order,
  File "/usr/lib/python2.7/dist-packages/sage/misc/", line 27, in <module>
    from sage.rings.complex_double import CDF
  File "sage/rings/complex_double.pyx", line 1, in init sage.rings.complex_double (build/cythonized/sage/rings/complex_double.c:22356)
  File "sage/rings/ring.pyx", line 1, in init sage.rings.ring (build/cythonized/sage/rings/ring.c:22311)
  File "sage/structure/parent_gens.pyx", line 1, in init sage.structure.parent_gens (build/cythonized/sage/structure/parent_gens.c:5388)
  File "sage/structure/parent_base.pyx", line 1, in init sage.structure.parent_base (build/cythonized/sage/structure/parent_base.c:2543)
  File "sage/structure/parent_old.pyx", line 1, in init sage.structure.parent_old (build/cythonized/sage/structure/parent_old.c:8649)
  File "sage/structure/parent.pyx", line 1, in init sage.structure.parent (build/cythonized/sage/structure/parent.c:27339)
  File "sage/structure/category_object.pyx", line 62, in init sage.structure.category_object (build/cythonized/sage/structure/category_object.c:9657)
  File "/usr/lib/python2.7/dist-packages/sage/categories/", line 110, in <module>
    from sage.misc.unknown import Unknown
  File "/usr/lib/python2.7/dist-packages/sage/misc/", line 11, in <module>
    from sage.structure.unique_representation import UniqueRepresentation
  File "/usr/lib/python2.7/dist-packages/sage/structure/", line 570, in <module>
    class CachedRepresentation(six.with_metaclass(ClasscallMetaclass)):
  File "/usr/local/lib/python2.7/dist-packages/", line 809, in with_metaclass
    return type.__new__(metaclass, 'temporary_class', (), {})
TypeError: type.__new__(metaclass) is not safe, use sage.misc.classcall_metaclass.ClasscallMetaclass.__new__()

the file in question is harmless enough:

> head -n 20

# This file was *autogenerated* from the file Fehlerrechnung-2019-02-19-085035.sage
from sage.all_cmdline import *   # import sage library

_sage_const_2 = Integer(2); _sage_const_1 = Integer(1); _sage_const_4 = Integer(4); _sage_const_8 = Integer(8); _sage_const_40 = Integer(40); _sage_const_p999 = RealNumber('.999'); _sage_const_21p75 = RealNumber('21.75'); _sage_const_p25 = RealNumber('.25'); _sage_const_0p2 = RealNumber('0.2'); _sage_const_p05 = RealNumber('.05'); _sage_const_0p001 = RealNumber('0.001'); _sage_const_3p5 = RealNumber('3.5'); _sage_const_0p075 = RealNumber('0.075'); _sage_const_0p99 = RealNumber('0.99'); _sage_const_p075 = RealNumber('.075'); _sage_const_p1 = RealNumber('.1'); _sage_const_8p854187817en12 = RealNumber('8.854187817e-12'); _sage_const_75 = Integer(75); _sage_const_77 = Integer(77); _sage_const_76 = Integer(76); _sage_const_1p001 = RealNumber('1.001'); _sage_const_0p0001 = RealNumber('0.0001')
x,d_e, e_m, e_s, v_ges, U =var('x d_e e_m e_s v_ges U')
d_k = var('d_k', latex_name=r'\varDelta z_{dc}')
d_m = var('d_m', latex_name=r'\varDelta z_{ds}')

#========= dielectric constants ==================================
e_0 = var('e_0', latex_name=r'\varepsilon_0')
e_s = var('e_s', latex_name=r'\varepsilon_s')
# seawater
e_m = var('e_m', latex_name=r'\varepsilon_m')

e_Ersatz = var('e_Ersatz', latex_name=r'\varepsilon_{Ersatz}')
e_Ersatz = d_k * ( (e_m/d_m) + (e_s/(d_k-d_m) ) )
show( SR.symbol('e_Ersatz') == e_Ersatz)
#latex(SR.symbol('e_Ersatz') == e_Ersatz)

how can i fix this? is it a debian problem? the debian bug tracker does not know about it:

edit retag flag offensive close merge delete


How did you install Sagemath? Did you compile it yourself? Is it a precompiled binary? Did you install the debian package sagemath? Looking at your traceback it looks like the last option. Though it is very strange as it seems that you have two incompatible version of Sage installed and interacting... You should describe precisely your settings and how did you "upgrade" sagemath.

vdelecroix gravatar imagevdelecroix ( 2019-03-17 17:42:03 +0200 )edit

I changed my debian repository from stable to testing and did a apt update; apt update. in the process sagemath was upgraded, too, along with a many other packages.

The rest of the system works (as far as I can tell).

my settings for what? a debian system consists of many settings. i do keep most of them to their default, though. can you tell which debian package might be to at its wrong (old?) version? i could give it a nudge. I can find out which package contains which files, if that helps. I reinstalled now sagemath-common, which contained all the files mentioned under sage in the traceback, but the error remains.

stockh0lm gravatar imagestockh0lm ( 2019-03-17 22:31:30 +0200 )edit

What is also strange is that what you use for a .sage file is something that was actually produced by the sage preparser to transform a sage input into python input. Does sage starts normally? Could you try to rename your .sage to .py and try again?

vdelecroix gravatar imagevdelecroix ( 2019-03-17 22:54:33 +0200 )edit


> mv Fehlerrechnung-2019-02-19-085035.sage
> sage
  File "", line 43
    v(e,Q,r) = Q/(e*r)
SyntaxError: can't assign to function call

is this what you expected?

stockh0lm gravatar imagestockh0lm ( 2019-03-17 23:34:39 +0200 )edit

My bad you did not obtain this file by running the preparser. You took an output from the preparser (as can be seen on the first line) and add some sagemath code to it. Remove the lines in your file from the first line up to the beginning of your code, that is

x,d_e, e_m, e_s, v_ges, U =var('x d_e e_m e_s v_ges U')

Then try again.

vdelecroix gravatar imagevdelecroix ( 2019-03-18 07:17:41 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-26 11:20:07 +0200

stockh0lm gravatar image

This was caused by locally installed python packages that threw sage off. Thanks to for figuring it out.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-03-16 17:03:33 +0200

Seen: 577 times

Last updated: Mar 26 '19