Hello,
Every time I start sage math it quits with an error message. I have tried 
rebooting and reinstalling; It still produces the same result. Error log is 
attached

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sage-support/bbaa5062-0a1b-49a2-8820-b1bf00b3e82bn%40googlegroups.com.
***************************************************************************

IPython post-mortem report

{'commit_hash': '4d6a64ace',
 'commit_source': 'installation',
 'default_encoding': 'utf-8',
 'ipython_path': '/usr/lib/python3.13/site-packages/IPython',
 'ipython_version': '9.7.0',
 'os_name': 'posix',
 'platform': 'Linux-6.17.7-3-cachyos-x86_64-with-glibc2.42',
 'sys_executable': '/usr/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.13.7 (main, Sep  9 2025, 16:20:24) [GCC 15.2.1 20250813]'}

***************************************************************************

Application name: Sage

Current user configuration structure:

{'IPCompleter': {'use_jedi': False},
 'InteractiveShell': {'ast_node_interactivity': 'all',
                      'colors': 'neutral',
                      'confirm_exit': False,
                      'prompts_class': <class 'sage.repl.prompts.SagePrompts'>,
                      'separate_in': '',
                      'simple_prompt': False,
                      'term_title': True},
 'InteractiveShellApp': {'extensions': ['sage']},
 'TerminalIPythonApp': {'display_banner': False,
                        'shell_class': <class 
'sage.repl.interpreter.SageTerminalInteractiveShell'>,
                        'test_shell': False,
                        'verbose_crash': True},
 'TerminalInteractiveShell': {'ast_node_interactivity': 'all',
                              'colors': 'neutral',
                              'confirm_exit': False,
                              'prompts_class': <class 
'sage.repl.prompts.SagePrompts'>,
                              'separate_in': '',
                              'simple_prompt': False,
                              'term_title': True}}

***************************************************************************

Crash traceback:

---------------------------------------------------------------------------
---------------------------------------------------------------------------
ImportError                                  Python 3.13.7: /usr/bin/python
                                                   Thu Nov  6 13:00:33 2025
A problem occurred executing Python code.  Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
File /usr/bin/sage:8
      1 #!/usr/bin/python
      2 # -*- coding: utf-8 -*-
      3 import re
      4 import sys
      5 from sage.cli import main
      6 if __name__ == "__main__":
      7     sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
----> 8     sys.exit(main())

File /usr/lib/python3.13/site-packages/sage/cli/__init__.py:48, in main()
     15 def main() -> int:
     16     input_args = sys.argv[1:]
     17     parser = argparse.ArgumentParser(
     18         prog="sage",
     19         description="If no command is given, starts the interactive 
interpreter where you can enter statements and expressions, immediately execute 
them and see their results.",
     20     )
     21     parser.add_argument(
     22         "-v",
     23         "--verbose",
   (...)     26         help="print additional information",
     27     )
     28     parser.add_argument(
     29         "-q",
     30         "--quiet",
   (...)     33         help="do not display the banner",
     34     )
     35     parser.add_argument(
     36         "--simple-prompt",
     37         action="store_true",
     38         default=False,
     39         help="use simple prompt IPython mode",
     40     )
     42     VersionCmd.extend_parser(parser)
     43     JupyterNotebookCmd.extend_parser(parser)
     44     EvalCmd.extend_parser(parser)
     45     RunFileCmd.extend_parser(parser)
     47     if not input_args:
---> 48         return InteractiveShellCmd(CliOptions()).run()
     50     args = parser.parse_args(input_args)
     51     options = CliOptions(**vars(args))
     53     logging.basicConfig(level=logging.DEBUG if options.verbose else 
logging.INFO)
     55     if args.file:
     56         return RunFileCmd(options).run()
     57     elif args.command:
     58         return EvalCmd(options).run()
     59     elif args.notebook:
     60         return JupyterNotebookCmd(options).run()
     61     return InteractiveShellCmd(options).run()

File /usr/lib/python3.13/site-packages/sage/cli/interactive_shell_cmd.py:27, in 
InteractiveShellCmd.run(self=<sage.cli.interactive_shell_cmd.InteractiveShellCmd
 object>)
     11 def run(self) -> int:
     12     r"""
     13     Start the interactive shell.
     14     """
     15     # Display startup banner. Do this before anything else to give the 
user
     16     # early feedback that Sage is starting.
     17     if not self.options.quiet:
     18         from sage.misc.banner import banner
     19         banner()
     21     from sage.repl.interpreter import SageTerminalApp
     23     app = SageTerminalApp.instance()
     24     if self.options.simple_prompt:
     25         app.config['InteractiveShell']['simple_prompt'] = True
     26         app.config['InteractiveShell']['colors'] = 'nocolor'
---> 27     app.initialize([])
        app = <sage.repl.interpreter.SageTerminalApp object at 0x7f2d462e5010>  
   28     return app.start()  # type: ignore

File /usr/lib/python3.13/site-packages/traitlets/config/application.py:118, in 
catch_config_error.<locals>.inner(app=<sage.repl.interpreter.SageTerminalApp 
object>, *args=([],), **kwargs={})
    115 @functools.wraps(method)
    116 def inner(app: Application, *args: t.Any, **kwargs: t.Any) -> t.Any:
    117     try:
--> 118         return method(app, *args, **kwargs)
        method = <function TerminalIPythonApp.initialize at 0x7f2d4511c7c0>
        app = <sage.repl.interpreter.SageTerminalApp object at 0x7f2d462e5010>
        args = ([],)
        kwargs = {}    119     except (TraitError, ArgumentError) as e:
    120         app.log.fatal("Bad config encountered during initialization: 
%s", e)
    121         app.log.debug("Config at the time: %s", app.config)
    122         app.exit(1)

File /usr/lib/python3.13/site-packages/IPython/terminal/ipapp.py:286, in 
TerminalIPythonApp.initialize(self=<sage.repl.interpreter.SageTerminalApp 
object>, argv=[])
    274 @catch_config_error
    275 def initialize(self, argv=None):
    276     """Do actions after construct, but before starting the app."""
    277     super(TerminalIPythonApp, self).initialize(argv)
    278     if self.subapp is not None:
    279         # don't bother initializing further, starting subapp
    280         return
    281     # print(self.extra_args)
    282     if self.extra_args and not self.something_to_run:
    283         self.file_to_run = self.extra_args[0]
    284     self.init_path()
    285     # create the shell
--> 286     self.init_shell()
        self = <sage.repl.interpreter.SageTerminalApp object at 0x7f2d462e5010> 
   287     # and draw the banner
    288     self.init_banner()
    289     # Now a variety of things that happen after the banner is printed.
    290     self.init_gui_pylab()
    291     self.init_extensions()
    292     self.init_code()

File /usr/lib/python3.13/site-packages/sage/repl/interpreter.py:832, in 
SageTerminalApp.init_shell(self=<sage.repl.interpreter.SageTerminalApp object>)
    815 def init_shell(self):
    816     r"""
    817     Initialize the :class:`SageInteractiveShell` instance.
    818 
   (...)    829         <sage.repl.interpreter.SageTestShell object at 0x...>
    830     """
    831     # Shell initialization
--> 832     self.shell = self.shell_class.instance(
        self = <sage.repl.interpreter.SageTerminalApp object at 0x7f2d462e5010> 
   833         parent=self,
    834         config=self.config,
    835         profile_dir=self.profile_dir,
    836         ipython_dir=self.ipython_dir)
    837     self.shell.configurables.append(self)
    838     self.shell.has_sage_extensions = SAGE_EXTENSION in self.extensions
    840     # Load the %lprun extension if available
    841     try:
    842         import line_profiler
    843         assert line_profiler  # silence pyflakes
    844     except ImportError:
    845         pass
    846     else:
    847         self.extensions.append('line_profiler')
    849     if self.shell.has_sage_extensions:
    850         self.extensions.remove(SAGE_EXTENSION)
    852         # load sage extension here to get a crash if
    853         # something is wrong with the sage library
    854         self.shell.extension_manager.load_extension(SAGE_EXTENSION)

File /usr/lib/python3.13/site-packages/traitlets/config/configurable.py:583, in 
SingletonConfigurable.instance(cls=<class 
'sage.repl.interpreter.SageTerminalInteractiveShell'>, *args=(), 
**kwargs={'config': {'TerminalIPythonApp': {'display_banner': False,...': 
['sage']}, 'IPCompleter': {'use_jedi': False}}, 'ipython_dir': 
'/home/brandon/.ipython', 'parent': <sage.repl.interpreter.SageTerminalApp 
object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>})
    553 @classmethod
    554 def instance(cls: type[CT], *args: t.Any, **kwargs: t.Any) -> CT:
    555     """Returns a global instance of this class.
    556 
    557     This method create a new instance if none have previously been 
created
   (...)    579         True
    580     """
    581     # Create and save the instance
    582     if cls._instance is None:
--> 583         inst = cls(*args, **kwargs)
        cls = <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>
        args = ()
        kwargs = {'parent': <sage.repl.interpreter.SageTerminalApp object at 
0x7f2d462e5010>, 'config': {'TerminalIPythonApp': {'display_banner': False, 
'verbose_crash': True, 'test_shell': False, 'shell_class': <class 
'sage.repl.interpreter.SageTerminalInteractiveShell'>}, 'InteractiveShell': 
{'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 
'ast_node_interactivity': 'all', 'colors': 'neutral', 'simple_prompt': False, 
'term_title': True, 'confirm_exit': False, 'separate_in': ''}, 
'TerminalInteractiveShell': {'prompts_class': <class 
'sage.repl.prompts.SagePrompts'>, 'ast_node_interactivity': 'all', 'colors': 
'neutral', 'simple_prompt': False, 'term_title': True, 'confirm_exit': False, 
'separate_in': ''}, 'InteractiveShellApp': {'extensions': ['sage']}, 
'IPCompleter': {'use_jedi': False}}, 'profile_dir': 
<IPython.core.profiledir.ProfileDir object at 0x7f2d451356a0>, 'ipython_dir': 
'/home/brandon/.ipython'}    584         # Now make sure that the instance will 
also be returned by
    585         # parent classes' _instance attribute.
    586         for subclass in cls._walk_mro():
    587             subclass._instance = inst
    589     if isinstance(cls._instance, cls):
    590         return cls._instance
    591     else:
    592         raise MultipleInstanceError(
    593             f"An incompatible sibling of '{cls.__name__}' is already 
instantiated"
    594             f" as singleton: {type(cls._instance).__name__}"
    595         )

File 
/usr/lib/python3.13/site-packages/IPython/terminal/interactiveshell.py:984, in 
TerminalInteractiveShell.__init__(self=<sage.repl.interpreter.SageTerminalInteractiveShell
 object>, *args=(), **kwargs={'config': {'TerminalIPythonApp': 
{'display_banner': False,...': ['sage']}, 'IPCompleter': {'use_jedi': False}}, 
'ipython_dir': '/home/brandon/.ipython', 'parent': 
<sage.repl.interpreter.SageTerminalApp object>, 'profile_dir': 
<IPython.core.profiledir.ProfileDir object>})
    983 def __init__(self, *args, **kwargs) -> None:
--> 984     super().__init__(*args, **kwargs)
        args = ()
        kwargs = {'parent': <sage.repl.interpreter.SageTerminalApp object at 
0x7f2d462e5010>, 'config': {'TerminalIPythonApp': {'display_banner': False, 
'verbose_crash': True, 'test_shell': False, 'shell_class': <class 
'sage.repl.interpreter.SageTerminalInteractiveShell'>}, 'InteractiveShell': 
{'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 
'ast_node_interactivity': 'all', 'colors': 'neutral', 'simple_prompt': False, 
'term_title': True, 'confirm_exit': False, 'separate_in': ''}, 
'TerminalInteractiveShell': {'prompts_class': <class 
'sage.repl.prompts.SagePrompts'>, 'ast_node_interactivity': 'all', 'colors': 
'neutral', 'simple_prompt': False, 'term_title': True, 'confirm_exit': False, 
'separate_in': ''}, 'InteractiveShellApp': {'extensions': ['sage']}, 
'IPCompleter': {'use_jedi': False}}, 'profile_dir': 
<IPython.core.profiledir.ProfileDir object at 0x7f2d451356a0>, 'ipython_dir': 
'/home/brandon/.ipython'}    985     
self._set_autosuggestions(self.autosuggestions_provider)
    986     self.init_prompt_toolkit_cli()
    987     self.init_term_title()
    988     self.keep_running = True
    989     self._set_formatter(self.autoformatter)

File /usr/lib/python3.13/site-packages/IPython/core/interactiveshell.py:664, in 
InteractiveShell.__init__(self=<sage.repl.interpreter.SageTerminalInteractiveShell
 object>, ipython_dir='/home/brandon/.ipython', 
profile_dir=<IPython.core.profiledir.ProfileDir object>, user_module=None, 
user_ns=None, custom_exceptions=((), None), **kwargs={'config': 
{'TerminalIPythonApp': {'display_banner': False,...': ['sage']}, 'IPCompleter': 
{'use_jedi': False}}, 'parent': <sage.repl.interpreter.SageTerminalApp object>})
    645 self.init_prefilter()
    647 self.init_syntax_highlighting()
    648 self.init_hooks()
    649 self.init_events()
    650 self.init_pushd_popd_magic()
    651 self.init_user_ns()
    652 self.init_logger()
    653 self.init_builtins()
    655 # The following was in post_config_initialization
    656 self.raw_input_original = input
    657 self.init_completer()
    658 # TODO: init_io() needs to happen before init_traceback handlers
    659 # because the traceback handlers hardcode the stdout/stderr streams.
    660 # This logic in in debugger.Pdb and should eventually be changed.
    661 self.init_io()
    662 self.init_traceback_handlers(custom_exceptions)
    663 self.init_prompts()
--> 664 self.init_display_formatter()
        self = <sage.repl.interpreter.SageTerminalInteractiveShell object at 
0x7f2d451357f0>    665 self.init_display_pub()
    666 self.init_data_pub()
    667 self.init_displayhook()
    668 self.init_magics()
    669 self.init_alias()
    670 self.init_logstart()
    671 self.init_pdb()
    672 self.init_extension_manager()
    673 self.init_payload()
    674 self.events.trigger('shell_initialized', self)
    675 atexit.register(self.atexit_operations)
    677 # The trio runner is used for running Trio in the foreground thread. It
    678 # is different from `_trio_runner(async_fn)` in `async_helpers.py`
    679 # which calls `trio.run()` for every cell. This runner runs all cells
    680 # inside a single Trio event loop. If used, it is set from
    681 # `ipykernel.kernelapp`.
    682 self.trio_runner = None
    683 self.showing_traceback = False

File /usr/lib/python3.13/site-packages/sage/repl/interpreter.py:300, in 
SageTerminalInteractiveShell.init_display_formatter(self=<sage.repl.interpreter.SageTerminalInteractiveShell
 object>)
    289 def init_display_formatter(self):
    290     """
    291     Switch to the Sage IPython commandline rich output backend.
    292 
   (...)    296         sage: 
SageTerminalInteractiveShell().init_display_formatter()   # not tested
    297     """
    298     from sage.repl.rich_output.backend_ipython import 
BackendIPythonCommandline
    299     backend = BackendIPythonCommandline()
--> 300     backend.get_display_manager().switch_backend(backend, shell=self)
        backend = IPython command line
        self = <sage.repl.interpreter.SageTerminalInteractiveShell object at 
0x7f2d451357f0>
File 
/usr/lib/python3.13/site-packages/sage/repl/rich_output/display_manager.py:321, 
in DisplayManager.switch_backend(self=The Sage display manager using the 
IPython command line backend, backend=IPython command line, **kwds={'shell': 
<sage.repl.interpreter.SageTerminalInteractiveShell object>})
    305 if not any(issubclass(out, OutputPlainText) for out in supported):
    306     raise ValueError('every backend must support plain text')
    307 try:
    308     self._backend.uninstall()
    309 except AttributeError:
    310     pass   # first time we switch
    311 # clear caches
    312 self._output_promotions = dict()
    313 self._supported_output = frozenset(
    314     map(self._demote_output_class, backend.supported_output()))
    315 # install new backend
    316 try:
    317     old_backend = self._backend
    318 except AttributeError:
    319     old_backend = None
    320 self._backend = backend
--> 321 self._backend.install(**kwds)
        self._backend = IPython command line
        self = The Sage display manager using the IPython command line backend
        kwds = {'shell': <sage.repl.interpreter.SageTerminalInteractiveShell 
object at 0x7f2d451357f0>}    322 self._preferences = 
DisplayPreferences(self._backend.default_preferences())
    323 return old_backend

File 
/usr/lib/python3.13/site-packages/sage/repl/rich_output/backend_ipython.py:60, 
in BackendIPython.install(self=IPython command line, **kwds={'shell': 
<sage.repl.interpreter.SageTerminalInteractiveShell object>})
     38 def install(self, **kwds):
     39     """
     40     Switch the Sage rich output to the IPython backend.
     41 
   (...)     57         2
     58     """
     59     shell = kwds['shell']
---> 60     from sage.repl.display.formatter import SageDisplayFormatter
     61     shell.display_formatter = SageDisplayFormatter(parent=shell)
     62     shell.configurables.append(shell.display_formatter)

File /usr/lib/python3.13/site-packages/sage/repl/display/formatter.py:66
      1 # sage_setup: distribution = sagemath-repl
      2 r"""
      3 IPython Displayhook Formatters
      4 
   (...)     51 :class:`~sage.typeset.ascii_art.AsciiArt` object (see and
     52 :meth:`sage.structure.sage_object.SageObject._ascii_art_`).  """
     54 # 
****************************************************************************
     55 #       Copyright (C) 2014 Volker Braun <[email protected]>
     56 #
   (...)     60 #                  https://www.gnu.org/licenses/
     61 # 
****************************************************************************
     63 from io import StringIO
     65 from IPython.core.formatters import DisplayFormatter, PlainTextFormatter
---> 66 from IPython.utils.py3compat import unicode_to_str
     67 from IPython.core.display import DisplayObject
     69 from ipywidgets import Widget
     71 from sage.repl.display.pretty_print import SagePrettyPrinter
     72 from sage.misc.lazy_import import lazy_import
     74 IPYTHON_NATIVE_TYPES = (DisplayObject, Widget)
     76 PLAIN_TEXT = 'text/plain'
     77 TEXT_LATEX = 'text/latex'
     78 TEXT_HTML = 'text/html'
     80 lazy_import('matplotlib.figure', 'Figure')
     83 class SageDisplayFormatter(DisplayFormatter):
     85     def __init__(self, *args, **kwds):
     86         """
     87         This is where the Sage rich objects are translated to IPython.
     88 
   (...)    100             RuntimeError: check failed: current backend is 
invalid
    101         """
    102         super().__init__(*args, **kwds)
    103         from sage.repl.rich_output.display_manager import 
get_display_manager
    104         self.dm = get_display_manager()

ImportError: cannot import name 'unicode_to_str' from 'IPython.utils.py3compat' 
(/usr/lib/python3.13/site-packages/IPython/utils/py3compat.py)

***************************************************************************

History of session input:

Reply via email to