cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
79 stars 26 forks source link

Python 3.10 and maxima #700

Closed ngg closed 2 years ago

ngg commented 2 years ago

I'm using sage 9.6 currently and I'd like to switch to using python 3.10 on my system. Maxima is the single package that has a problem because the 5.45.1 version that's keyworded only supports python 3.9 https://github.com/cschwan/sage-on-gentoo/blob/24fe9316c13089fdee7880b69ab9b0a93b716d22/package.keywords/sage-9.6#L26 Note that the same version is keyworded in the sage-9999 file as well: https://github.com/cschwan/sage-on-gentoo/blob/24fe9316c13089fdee7880b69ab9b0a93b716d22/package.keywords/sage-9999#L27

Would one of the following options work?

  1. Add python3.10 support to the 5.45.1 ebuild
  2. Use the newer 5.46.0 version that already supports python3.10

I think the safer approach would be to use the first option, as it seems to me that maxima only uses python to build its documentation and for the VTK plotting backend, not for its core functionality.

kiwifb commented 2 years ago

That's a fair question, and both possibilities have to be explored. Maxima is pinned because upgrading often breaks doctests but far less often functionality. So, the dependency probably can be loosened a bit, but needs testing. Similarly, backporting any needed python3.10 bits to maxima 5.45.1 should be tried.

kiwifb commented 2 years ago

Going to maxima 5.46.0 yields a number of failures

sage -t --long --random-seed=125012768507942088044789220032910576519 /usr/lib/python3.10/site-packages/sage/symbolic/integration/integral.py
**********************************************************************
File "/usr/lib/python3.10/site-packages/sage/symbolic/integration/integral.py", line 741, in sage.symbolic.integration.integral.integrate
Failed example:
    res = integral(f,x,0.0001414, 1.); res
Expected:
    2*y*arctan(1.0/y) - 2*y*arctan(0.0001414/y) + 1.0*log(1.0*y^2 + 1.0) - 0.0001414*log(1.0*y^2 + 1.9993959999999997e-08) - 1.9997172
Got:
    -2*y*arctan(1/196559360927*sqrt(196559360927)*sqrt(3930)/y) + 2*y*arctan(1/y) - 1/196559360927*sqrt(196559360927)*sqrt(3930)*log(y^2 + 3930/196559360927) + 2/196559360927*sqrt(196559360927)*sqrt(3930) + log(y^2 + 1) - 2
**********************************************************************
sage -t --long --random-seed=125012768507942088044789220032910576519 /usr/lib/python3.10/site-packages/sage/functions/exp_integral.py
**********************************************************************
File "/usr/lib/python3.10/site-packages/sage/functions/exp_integral.py", line 605, in sage.functions.exp_integral.Function_log_integral_offset
Failed example:
    Li(x).integrate(x,2.0,4.5)
Expected:
    -2.5*log_integral(2) + 5.799321147411334
Got:
    -Ei(2*log(9/2)) + Ei(2*log(2)) + 9/2*log_integral(9/2) - 4.5*log_integral(2)
**********************************************************************
sage -t --long --random-seed=125012768507942088044789220032910576519 /usr/lib/python3.10/site-packages/sage/calculus/calculus.py
**********************************************************************
File "/usr/lib/python3.10/site-packages/sage/calculus/calculus.py", line 1188, in sage.calculus.calculus.limit
Failed example:
    f.limit(x=1.2)
Expected:
    2.06961575467...
Got:
    und
**********************************************************************
File "/usr/lib/python3.10/site-packages/sage/calculus/calculus.py", line 1217, in sage.calculus.calculus.limit
Failed example:
    limit(x^a,x=0)
Expected:
    Traceback (most recent call last):
    ...
    ValueError: Computation failed since Maxima requested additional
    constraints; using the 'assume' command before evaluation *may* help
    (example of legal syntax is 'assume(a>0)', see `assume?` for
     more details)
    Is a an integer?
Got:
    0
**********************************************************************
File "/usr/lib/python3.10/site-packages/sage/calculus/calculus.py", line 1226, in sage.calculus.calculus.limit
Failed example:
    limit(x^a, x=0)
Expected:
    Traceback (most recent call last):
    ...
    ValueError: Computation failed since Maxima requested additional
    constraints; using the 'assume' command before evaluation *may* help
    (example of legal syntax is 'assume(a>0)', see `assume?` for
     more details)
    Is a an even number?
Got:
    0
**********************************************************************
File "/usr/lib/python3.10/site-packages/sage/calculus/calculus.py", line 2253, in sage.calculus.calculus.symbolic_expression_from_maxima_string
Failed example:
    solve([x != 5], x)
Expected:
    #0: solve_rat_ineq(ineq=_SAGE_VAR_x # 5)
    [[x - 5 != 0]]
Got:
    #0: solve_rat_ineq(ineq=_SAGE_VAR_x # 5)
    [[x < 5], [5 < x]]
**********************************************************************
File "/usr/lib/python3.10/site-packages/sage/calculus/calculus.py", line 2256, in sage.calculus.calculus.symbolic_expression_from_maxima_string
Failed example:
    solve([2*x==3, x != 5], x)
Expected:
    [[x == (3/2), (-7/2) != 0]]
Got:
    [[x == (3/2)]]
**********************************************************************
sage -t --long --random-seed=125012768507942088044789220032910576519 /usr/lib/python3.10/site-packages/sage/symbolic/relation.py
**********************************************************************
File "/usr/lib/python3.10/site-packages/sage/symbolic/relation.py", line 1787, in sage.symbolic.relation.solve_ineq_fourier
Failed example:
    solve_ineq_fourier([x+y<9,x-y>4],[y,x])
Expected:
    [[y < min(x - 4, -x + 9)]]
Got:
    [[y < min(-x + 9, x - 4)]]
**********************************************************************
sage -t --long --random-seed=125012768507942088044789220032910576519 /usr/lib/python3.10/site-packages/sage/interfaces/maxima_lib.py
**********************************************************************
File "/usr/lib/python3.10/site-packages/sage/interfaces/maxima_lib.py", line 928, in sage.interfaces.maxima_lib.MaximaLib.sr_limit
Failed example:
    limit(f,x = 1.2)
Expected:
    2.06961575467...
Got:
    und
**********************************************************************
File "/usr/lib/python3.10/site-packages/sage/interfaces/maxima_lib.py", line 941, in sage.interfaces.maxima_lib.MaximaLib.sr_limit
Failed example:
    limit(x^a,x=0)
Expected:
    Traceback (most recent call last):
    ...
    ValueError: Computation failed ...
    Is a an integer?
Got:
    0
**********************************************************************

Way too much noise for trying to allow it. And there is a need for new assumptions in several places. I will look into allowing python 3.10 in 5.45.1.

kiwifb commented 2 years ago

The things you learn. Maxima .5.45.1 relies on the AM_PATH_PYTHON that comes from automake. This macro doesn't support python version higher than 3.9 in automake-1.16.5. There are no released version of automake that support python 3.10. I can see from the git repo of automake that the next version is looking to support up to version 3.15.

Maxima 5.46.0 do not use any detection of python. On the other hand, the detection is really about supporting vtk. And when you read the following in the ebuild

# VTK is an optional plotting backend that can be enabled by
# running "draw_renderer: 'vtk;" within maxima.
#
# It's NON-optional for the scene() command, but that command is
# currently useless since Tcl/Tk support was dropped in sci-libs/vtk.
# Thus we include VTK only as an optional dependency.

it should just be removed. I suspect that if we remove the vtk use flag and ignore the python detection in configure and only set a python for the doc, python3.10 will work just fine.

kiwifb commented 2 years ago

Actually, 5.46.0 do not use python anymore for the doc. And a nice patch in the current 5.45.1 makes use of the automake result. I will have to rectify that in the process.

kiwifb commented 2 years ago

Sorry for the massive delay. Fixed by 3ffd48484bb88071b90532b72a8ac84de038c77a - reopen if you have issues with it.