An incompatible bug in the interface.fricas and the system's FriCAS in Ubuntu 25.04
Steps To Reproduce
sage:fricas('3')
Expected Behavior
3
Actual Behavior
sage: fricas(3)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
File ~/sage/src/sage/interfaces/expect.py:1519, in ExpectElement.__init__(self, parent, value, is_name, name)
1518 try:
-> 1519 self._name = parent._create(value, name=name)
1520 # Convert ValueError and RuntimeError to TypeError for
1521 # coercion to work properly.
File ~/sage/src/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 ~/sage/src/sage/interfaces/fricas.py:681, in FriCAS.set(self, var, value)
680 output = self.eval(cmd, reformat=False)
--> 681 self._check_errors(value, output)
File ~/sage/src/sage/interfaces/fricas.py:574, in FriCAS._check_errors(self, line, output)
573 output = output.replace(old, new)
--> 574 raise RuntimeError("An error occurred when FriCAS evaluated '%s':\n%s" % (line, output))
576 # or even an error
RuntimeError: An error occurred when FriCAS evaluated '3':
Function declaration sageprint : InputForm -> String has been added to
workspace.
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Cell In[1], line 1
----> 1 fricas(Integer(3))
File ~/sage/src/sage/misc/lazy_import.pyx:397, in sage.misc.lazy_import.LazyImport.__call__()
395 True
396 """
--> 397 return self.get_object()(*args, **kwds)
398
399 def __repr__(self):
File ~/sage/src/sage/interfaces/interface.py:306, in Interface.__call__(self, x, name)
299 return cls(self, x, name=name)
300 try:
301 # Special methods do not and should not have an option to
302 # set the name directly, as the identifier assigned by the
303 # interface should stay consistent. An identifier with a
304 # user-assigned name might change its value, so we return a
305 # new element.
--> 306 result = self._coerce_from_special_method(x)
307 return result if name is None else result.name(new_name=name)
308 except TypeError:
File ~/sage/src/sage/interfaces/interface.py:334, in Interface._coerce_from_special_method(self, x)
332 s = '_gp_'
333 try:
--> 334 return (x.__getattribute__(s))(self)
335 except AttributeError:
336 return self(x._interface_init_())
File ~/sage/src/sage/structure/sage_object.pyx:793, in sage.structure.sage_object.SageObject._fricas_()
791 import sage.interfaces.fricas
792 G = sage.interfaces.fricas.fricas
--> 793 return self._interface_(G)
794
795 def _fricas_init_(self):
File ~/sage/src/sage/structure/sage_object.pyx:723, in sage.structure.sage_object.SageObject._interface_()
721 except Exception:
722 raise NotImplementedError("coercion of object %s to %s not implemented" % (repr(self), I))
--> 723 X = I(s)
724 if c:
725 try:
File ~/sage/src/sage/interfaces/interface.py:299, in Interface.__call__(self, x, name)
296 pass
298 if isinstance(x, str):
--> 299 return cls(self, x, name=name)
300 try:
301 # Special methods do not and should not have an option to
302 # set the name directly, as the identifier assigned by the
303 # interface should stay consistent. An identifier with a
304 # user-assigned name might change its value, so we return a
305 # new element.
306 result = self._coerce_from_special_method(x)
File ~/sage/src/sage/interfaces/expect.py:1524, in ExpectElement.__init__(self, parent, value, is_name, name)
1522 except (RuntimeError, ValueError) as x:
1523 self._session_number = -1
-> 1524 raise TypeError(*x.args)
1525 except BaseException:
1526 self._session_number = -1
TypeError: An error occurred when FriCAS evaluated '3':
Function declaration sageprint : InputForm -> String has been added to
workspace.
sage: fricas(3)
<repr(<sage.interfaces.fricas.FriCASElement at 0x73b6eae59350>) failed: AttributeError: 'NoneType' object has no attribute 'rstrip'>
sage: fricas(3)
<repr(<sage.interfaces.fricas.FriCASElement at 0x73b6ea563610>) failed: AttributeError: 'NoneType' object has no attribute 'rstrip'>
sage: fricas(3)
<repr(<sage.interfaces.fricas.FriCASElement at 0x73b6eaa090d0>) failed: RuntimeError: An error occurred when FriCAS evaluated 'sage3':
There are no library operations named category_for
Use HyperDoc Browse or issue
)what op category_for
to learn if there is any operation containing " category_for " in
its name.
Cannot find a definition or applicable library operation named
category_for with argument type(s)
PositiveInteger
Perhaps you should use "@" to indicate the required return type, or
"$" to specify which version of the function you need.>
Additional Information
I do not know it is a bug in sage or a bug in the Ubuntu 25.04's fricas. Can someone check it? But if we use sage -i fricas. The problem is solved. We need to report to Ubuntu. It is a very strange bug.
Environment
- OS: Ubuntu 25.04
- Sage Version: 10.7
Checklist
- [x] I have searched the existing issues for a bug report that matches the one I want to file, without success.
- [x] I have read the documentation and troubleshoot guide
@orlitzky can you check this?
It works OK with the system fricas-1.3.12 on Gentoo:
sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.7, Release Date: 2025-08-09 │
│ Using Python 3.13.5. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: fricas(3)
3
sage: fricas('3')
3
Someone with Ubuntu will have to debug.
It works OK with the system fricas-1.3.12 on Gentoo:
sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 10.7, Release Date: 2025-08-09 │ │ Using Python 3.13.5. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: fricas(3) 3 sage: fricas('3') 3Someone with Ubuntu will have to debug.
Maybe I need to report this to Ubuntu
I am running into the same issue! However my fricas version is 1.3.11 -
$ fricas --version
FriCAS 1.3.11
based on gcl 2.6.14
I am running into the same issue! However my fricas version is 1.3.11 -
$ fricas --version FriCAS 1.3.11 based on gcl 2.6.14
Just run sage -i fricas to install the sage's package
Just run
sage -i fricasto install the sage's package
Not a viable solution, it needs to be run everytime one runs tests. Plus sage -i fricas does not work with meson based installation.
Just run
sage -i fricasto install the sage's packageNot a viable solution, it needs to be run everytime one runs tests. Plus
sage -i fricasdoes not work with meson based installation.
Maybe the problem is the ubuntu's package. I try a lot of methods But I can not fix
Looks like fricas 1.3.12 solves the issue, I installed it just now on ubuntu and it seemed to work...
Looks like
fricas 1.3.12solves the issue, I installed it just now on ubuntu and it seemed to work...
You just install from source code? It is Ok
It even worked for fricas 1.3.11, looks like there is some other issue instead.
seems the problem suddenly gone
seems it needs to be sbcl compiled fricas
It is fixed.
It's not about Ubuntu, it's about GCL-based FriCAS (as provided by Debian and, thus, Ubuntu).
@mantepse - do you know why GCL FriCAS prints type info in Sage 10.7? Is it fixed in 10.8.betas?