Skip to content

Meson build: sage pexpect interface broken due to missing sage-ipython #39869

@antonio-rojas

Description

@antonio-rojas

Steps To Reproduce

When sage is built with meson, the sage pexpect interface is broken because it uses the no longer available sage-ipython script.

sage: Sage()("1")

Expected Behavior

No error

Actual Behavior

---------------------------------------------------------------------------
ExceptionPexpect                          Traceback (most recent call last)
File /usr/lib/python3.13/site-packages/sage/interfaces/expect.py:512, in Expect._start(self, alt_message, block_during_init)
    511 try:
--> 512     self._expect = SageSpawn(cmd,
    513             logfile=self.__logfile,
    514             timeout=None,  # no timeout
    515             env=pexpect_env,
    516             name=self._repr_(),
    517             echo=self._terminal_echo,
    518             # Work around https://bugs.python.org/issue1652
    519             preexec_fn=lambda: signal.signal(signal.SIGPIPE, signal.SIG_DFL),
    520             quit_string=self._quit_string())
    522     # Attempt to shutdown the running process gracefully
    523     # when sage terminates.

File sagespawn.pyx:66, in sage.interfaces.sagespawn.SageSpawn.__init__()

File sagespawn.pyx:67, in sage.interfaces.sagespawn.SageSpawn.__init__()

File /usr/lib/python3.13/site-packages/pexpect/pty_spawn.py:205, in spawn.__init__(self, command, args, timeout, maxread, searchwindowsize, logfile, cwd, env, ignore_sighup, echo, preexec_fn, encoding, codec_errors, dimensions, use_poll)
    204 else:
--> 205     self._spawn(command, args, preexec_fn, dimensions)
    206 self.use_poll = use_poll

File /usr/lib/python3.13/site-packages/pexpect/pty_spawn.py:276, in spawn._spawn(self, command, args, preexec_fn, dimensions)
    275 if command_with_path is None:
--> 276     raise ExceptionPexpect('The command was not found or was not ' +
    277             'executable: %s.' % self.command)
    278 self.command = command_with_path

ExceptionPexpect: The command was not found or was not executable: sage-ipython.

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
File /usr/lib/python3.13/site-packages/sage/interfaces/expect.py:1518, in ExpectElement.__init__(self, parent, value, is_name, name)
   1517 try:
-> 1518     self._name = parent._create(value, name=name)
   1519 # Convert ValueError and RuntimeError to TypeError for
   1520 # coercion to work properly.

File /usr/lib/python3.13/site-packages/sage/interfaces/interface.py:520, in Interface._create(self, value, name)
    519 name = self._next_var_name() if name is None else name
--> 520 self.set(name, value)
    521 return name

File /usr/lib/python3.13/site-packages/sage/interfaces/sage0.py:332, in Sage.set(self, var, value)
    331 cmd = '%s=%s' % (var, value)
--> 332 out = self.eval(cmd)
    333 if 'Traceback' in out:

File /usr/lib/python3.13/site-packages/sage/interfaces/sage0.py:319, in Sage.eval(self, line, strip, **kwds)
    318 line = self._wrap_multiline(line)
--> 319 return Expect.eval(self, line, **kwds).strip()

File /usr/lib/python3.13/site-packages/sage/interfaces/expect.py:1412, in Expect.eval(self, code, strip, synchronize, locals, allow_use_file, split_lines, **kwds)
   1411 elif split_lines:
-> 1412     return '\n'.join(self._eval_line(L, allow_use_file=allow_use_file, **kwds)
   1413                      for L in code.split('\n') if L)
   1414 else:

File /usr/lib/python3.13/site-packages/sage/interfaces/expect.py:1412, in <genexpr>(.0)
   1411 elif split_lines:
-> 1412     return '\n'.join(self._eval_line(L, allow_use_file=allow_use_file, **kwds)
   1413                      for L in code.split('\n') if L)
   1414 else:

File /usr/lib/python3.13/site-packages/sage/interfaces/expect.py:988, in Expect._eval_line(self, line, allow_use_file, wait_for_prompt, restart_if_needed)
    987 if self._expect is None:
--> 988     self._start()
    989 E = self._expect

File /usr/lib/python3.13/site-packages/sage/interfaces/expect.py:529, in Expect._start(self, alt_message, block_during_init)
    527     except (ExceptionPexpect, pexpect.EOF) as e:
    528         # Change pexpect errors to RuntimeError
--> 529         raise RuntimeError("unable to start %s because the command %r failed: %s\n%s" %
    530                 (self.name(), cmd, e, self._install_hints()))
    531 except BaseException:

RuntimeError: unable to start sage because the command 'sage-ipython --HistoryManager.hist_file=:memory: --colors=nocolor --no-term-title --simple-prompt' failed: The command was not found or was not executable: sage-ipython.


During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
Cell In[1], line 1
----> 1 Sage()("1")

File /usr/lib/python3.13/site-packages/sage/interfaces/sage0.py:254, in Sage.__call__(self, x)
    251         return self(x.sage())
    253 if isinstance(x, str):
--> 254     return SageElement(self, x)
    256 if self.is_local():
    257     with open(self._local_tmpfile(), 'wb') as fobj:

File /usr/lib/python3.13/site-packages/sage/interfaces/expect.py:1523, in ExpectElement.__init__(self, parent, value, is_name, name)
   1521 except (RuntimeError, ValueError) as x:
   1522     self._session_number = -1
-> 1523     raise TypeError(*x.args)
   1524 except BaseException:
   1525     self._session_number = -1

TypeError: unable to start sage because the command 'sage-ipython --HistoryManager.hist_file=:memory: --colors=nocolor --no-term-title --simple-prompt' failed: The command was not found or was not executable: sage-ipython.

Additional Information

No response

Environment

  • OS: Arch Linux
  • Sage Version: 10.7.beta0

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions