i believe The issue is that Sage uses its own mpmath backend (sage.libs.mpmath.ext_main) which replaces the standard mpmath.ctx_mp_python module, but mathics3 was trying to import mpf/mpc from that module.
On Sunday, March 15, 2026 at 6:56:06 PM UTC+2 [email protected] wrote: > Have you uninstalled mathics (i.e. "pip uninstall mathics"), before > trying Mathics3 ? > > There is also a potential problem that "pip install mathics" overwrote > some already installed packages, then "pip unistall" won't restore > them. > There is currently an incompatibility between mathics3 (as installed > by pip from PyPI, maybe the current development version is better), > and Sage packages sympy and mpmath. > > > On Sun, Mar 15, 2026 at 10:51 AM Rashad alsharpini2 > <[email protected]> wrote: > > > > that's what i did and resulted and this weird problem > > > > On Sunday, March 15, 2026 at 5:09:32 AM UTC+2 [email protected] wrote: > >> > >> You are installing an extremely out of data mathics pip package which > also forces installation of versions of other packages that are not > compatible with SageMath 10.9. > >> > >> You should run: > >> > >> %pip install Mathics3 > >> > >> instead.. That works for me. > >> > >> - Marc > >> > >> On Saturday, March 14, 2026 at 11:07:37 AM UTC-5 [email protected] > wrote: > >>> > >>> > >>> so i have install the package > >>> `pip install mathics3` and i get this huge error log > >>> would this be the objective of the project 'Improve integration with > Mathics' > >>> or this an isolated error for machine because i can't really i > identify the error > >>> i thought it was a mismatch in npmath package but that didn't solve it > >>> and there are a problem when calling the .sage() function to convert > the object to a sageobj > >>> (sage-dev) >>> sage [develop] pip list | grep -i mathics > >>> Mathics_Scanner 2.0.0 > >>> Mathics3 9.0.0 > >>> (sage-dev) >>> sage [develop] python --version > >>> Python 3.12.12 > >>> (sage-dev) >>> sage [develop] which python > >>> /home/rashad/.conda/envs/sage-dev/bin/python > >>> (sage-dev) >>> sage [develop] > >>> (sage-dev) >>> sage [develop] ./sage > >>> ┌────────────────────────────────────────────────────────────────────┐ > >>> │ SageMath version 10.9.beta7, Release Date: 2026-02-25 │ > >>> │ Using Python 3.12.12. Type "help()" for help. │ > >>> └────────────────────────────────────────────────────────────────────┘ > >>> ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ > >>> ┃ Warning: this is a prerelease version, and it may be unstable. ┃ > >>> ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ > >>> sage: from sage.interfaces.mathics import mathics > >>> sage: mobj = mathics(x^2 - 1); mobj > >>> > --------------------------------------------------------------------------- > >>> AttributeError Traceback (most recent call last) > >>> File ~/sage/sage/src/sage/interfaces/interface.py:329, in > Interface._coerce_from_special_method(self, x) > >>> 328 try: > >>> --> 329 return (x.__getattribute__(s))(self) > >>> 330 except AttributeError: > >>> > >>> File sage/structure/sage_object.pyx:979, in > sage.structure.sage_object.SageObject._mathics_() > >>> > >>> File sage/symbolic/expression.pyx:1123, in > sage.symbolic.expression.Expression._interface_() > >>> > >>> File sage/structure/sage_object.pyx:723, in > sage.structure.sage_object.SageObject._interface_() > >>> > >>> File ~/sage/sage/src/sage/interfaces/interface.py:294, in > Interface.__call__(self, x, name) > >>> 293 if isinstance(x, str): > >>> --> 294 return cls(self, x, name=name) > >>> 295 try: > >>> 296 # Special methods do not and should not have an option to > >>> 297 # set the name directly, as the identifier assigned by the > >>> 298 # interface should stay consistent. An identifier with a > >>> 299 # user-assigned name might change its value, so we return a > >>> 300 # new element. > >>> > >>> File ~/sage/sage/src/sage/interfaces/interface.py:732, in > InterfaceElement.__init__(self, parent, value, is_name, name) > >>> 731 try: > >>> --> 732 self._name = parent._create(value, name=name) > >>> 733 except (TypeError, RuntimeError, ValueError) as x: > >>> > >>> File ~/sage/sage/src/sage/interfaces/interface.py:515, in > Interface._create(self, value, name) > >>> 514 name = self._next_var_name() if name is None else name > >>> --> 515 self.set(name, value) > >>> 516 return name > >>> > >>> File ~/sage/sage/src/sage/interfaces/mathics.py:596, in > Mathics.set(self, var, value) > >>> 595 cmd = f'{var}={value};' > >>> --> 596 _ = self.eval(cmd) > >>> > >>> File ~/sage/sage/src/sage/interfaces/mathics.py:579, in > Mathics.eval(self, code, *args, **kwds) > >>> 570 """ > >>> 571 Evaluates a command inside the Mathics interpreter and returns the > output > >>> 572 in printable form. > >>> (...) 577 '2' > >>> 578 """ > >>> --> 579 res = self._eval(code) > >>> 580 if res.result == 'Null': > >>> > >>> File ~/sage/sage/src/sage/interfaces/mathics.py:562, in > Mathics._eval(self, code) > >>> 553 """ > >>> 554 Evaluates a command inside the Mathics interpreter and returns the > output > >>> 555 as a Mathics result. > >>> (...) 560 <Integer: 2> > >>> 561 """ > >>> --> 562 self._lazy_init() > >>> 563 S = self._session > >>> > >>> File ~/sage/sage/src/sage/interfaces/mathics.py:499, in > Mathics._lazy_init(self) > >>> 498 self._initialized = True > >>> --> 499 self._start() > >>> > >>> File ~/sage/sage/src/sage/interfaces/mathics.py:514, in > Mathics._start(self) > >>> 513 if not self._session: > >>> --> 514 from mathics.session import MathicsSession > >>> 515 from mathics.core.load_builtin import import_and_load_builtins > >>> > >>> File > ~/.conda/envs/sage-dev/lib/python3.12/site-packages/mathics/session.py:19 > >>> 17 from mathics_scanner.location import ContainerKind > >>> ---> 19 from mathics.core.definitions import Definitions > >>> 20 from mathics.core.evaluation import Evaluation, Result > >>> > >>> File > ~/.conda/envs/sage-dev/lib/python3.12/site-packages/mathics/core/definitions.py:17 > >>> 15 from mathics_scanner.tokeniser import full_names_pattern > >>> ---> 17 from mathics.core.atoms import Integer, String > >>> 18 from mathics.core.attributes import A_NO_ATTRIBUTES > >>> > >>> File > ~/.conda/envs/sage-dev/lib/python3.12/site-packages/mathics/core/atoms.py:50 > >>> 47 T = TypeVar("T") > >>> ---> 50 class Number(Atom, ImmutableValueMixin, NumericOperators, > Generic[T]): > >>> 51 """ > >>> 52 Different kinds of Mathics Numbers, the main built-in subclasses > >>> 53 being: Integer, Rational, Real, Complex. > >>> 54 """ > >>> > >>> File > ~/.conda/envs/sage-dev/lib/python3.12/site-packages/mathics/core/atoms.py:119, > > in Number() > >>> 117 return True > >>> --> 119 def to_mpmath(self, precision: Optional[int] = None) -> > mpmath.ctx_mp_python.mpf: > >>> 120 """ > >>> 121 Convert self.value to an mpmath number with precision ``precision`` > >>> 122 If ``precision`` is None, use mpmath's default precision. > >>> (...) 127 change the implementation accordingly. > >>> 128 """ > >>> > >>> AttributeError: module 'mpmath.ctx_mp_python' has no attribute 'mpf' > >>> > >>> During handling of the above exception, another exception occurred: > >>> > >>> TypeError Traceback (most recent call last) > >>> Cell In[2], line 1 > >>> ----> 1 mobj = mathics(x**Integer(2) - Integer(1)); mobj > >>> > >>> File ~/sage/sage/src/sage/interfaces/interface.py:301, in > Interface.__call__(self, x, name) > >>> 294 return cls(self, x, name=name) > >>> 295 try: > >>> 296 # Special methods do not and should not have an option to > >>> 297 # set the name directly, as the identifier assigned by the > >>> 298 # interface should stay consistent. An identifier with a > >>> 299 # user-assigned name might change its value, so we return a > >>> 300 # new element. > >>> --> 301 result = self._coerce_from_special_method(x) > >>> 302 return result if name is None else result.name(new_name=name) > >>> 303 except TypeError: > >>> > >>> File ~/sage/sage/src/sage/interfaces/interface.py:331, in > Interface._coerce_from_special_method(self, x) > >>> 329 return (x.__getattribute__(s))(self) > >>> 330 except AttributeError: > >>> --> 331 return self(x._interface_init_()) > >>> > >>> File sage/symbolic/expression.pyx:1151, in > sage.symbolic.expression.Expression._interface_init_() > >>> > >>> TypeError: _interface_init_() takes exactly 1 positional argument (0 > given) > >>> sage: > >>> > > -- > > 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 [email protected]. > > To view this discussion visit > https://groups.google.com/d/msgid/sage-devel/1f3136a6-dbb0-4cd4-b7f7-617888f507acn%40googlegroups.com > . > -- 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 [email protected]. To view this discussion visit https://groups.google.com/d/msgid/sage-devel/025333e2-b946-448b-9612-c4587c4c4556n%40googlegroups.com.
