[bug#76270,0/2] Add sage.

Message ID cover.1739459561.git.andreas@enge.fr
Headers
Series Add sage. |

Message

Andreas Enge Feb. 13, 2025, 3:13 p.m. UTC
  Andreas Enge (2):
  gnu: Add maxima-ecl.
  gnu: Add sage.

 gnu/local.mk                                  |    2 +
 gnu/packages/maths.scm                        |   36 +-
 gnu/packages/patches/sage-update-eclib.patch  |  222 +
 .../patches/sage-update-pari-gp.patch         | 5020 +++++++++++++++++
 gnu/packages/sagemath.scm                     |  152 +-
 5 files changed, 5428 insertions(+), 4 deletions(-)
 create mode 100644 gnu/packages/patches/sage-update-eclib.patch
 create mode 100644 gnu/packages/patches/sage-update-pari-gp.patch


base-commit: 2e72561e788a0bb37ffe887d546a394b70b8c212
  

Comments

Andreas Enge Feb. 13, 2025, 3:29 p.m. UTC | #1
Hello!

The next two commits add SageMath as the package sage to Guix.

Sage uses maxima, but needs maxima compiled with the ecl common lisp
implementation, which I have added as a new package maxima-ecl in 
addition to our current maxima, which is compiled with sbcl.
Ideally, instead of adding this maxima-ecl, I would just have it
replace our current maxima - in this way, we would have only one
maxima package; both should have the same functionality anyway.
What do you think?

I have taken a lot of care to patch the scripts in the sage package so
that the references to external binaries become internal with the
complete paths /gnu/store/..., so that only few propagated inputs are
needed (essentially Python libraries).
From inside sage, you can run %singular, %maxima, %gp or %gap to shell
out to these external computer algebra systems.

In my home profile, the REPL obtained by typing "sage" fails to start,
due to some mysterious conflict between, I suppose, propagated python
inputs pulled in through other packages. I could work around this by
   ./pre-inst-env guix shell -C --pure sage
and then running "sage" in the Guix shell.
The jupyter notebook is directly functional running "sage -n".

There are definitely lots of optional packages that could be added
as inputs in later steps. In that case, I would suggest that for each
new input we come up with a sage command that fails with the current
setup and succeeds with the enhanced setup, so as to "prove" that the
added inputs are indeed taken into account. (As an example, in a previous
iteration, I already had gmp-ecm as an input, but upon inspection it turned
out that it was not actually used to factor numbers using ECM, and I had to
add the
              (substitute* "src/sage/env.py"
                (("\"ecm\"")
                 (string-append "\"" #$gmp-ecm "/bin/ecm\""))
lines to the package.)

So far, I have only tried to compile on x86_64, where it succeeds.

I would suggest to replace our sbcl maxima package by the ebcl one,
and to push sage to master.

What do you think?

Andreas