void-packages icon indicating copy to clipboard operation
void-packages copied to clipboard

[BETA] sagemath: update to 10.5.beta7

Open tornaria opened this issue 1 year ago • 3 comments

  • python3-Cython: alternative fix for 6122
  • sagemath: enable all cython warnings
  • nauty: update to 2.8.9.

Testing the changes

  • I tested the changes in this PR: YES

@dkwo

tornaria avatar Aug 18 '24 17:08 tornaria

I tried to crosscompile sagemath from aarch64 to x86_64: it looks like we should add to hostmakedepends "python3-gmpy2 python3-memory_allocator python3-numpy ecl python3-cypari2 python3-cysignals python3-devel". Makes sense?

dkwo avatar Sep 09 '24 01:09 dkwo

I tried to crosscompile sagemath from aarch64 to x86_64: it looks like we should add to hostmakedepends "python3-gmpy2 python3-memory_allocator python3-numpy ecl python3-cypari2 python3-cysignals python3-devel". Makes sense?

Sure, but we still don't have cross for ntl and others, does it make sense to bother with this?

tornaria avatar Sep 10 '24 00:09 tornaria

True. It's still useful to know in general, and it could be useful later, if we decide e.g. to use qemu to build ntl etc.

dkwo avatar Sep 10 '24 20:09 dkwo

@dkwo is something like this enough to cross-compile:

--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -6,7 +6,9 @@ _pypi_version=${version/.beta/b}
 _pypi_version=${_pypi_version/.rc/rc}
 build_style=python3-pep517
 hostmakedepends="pkg-config python3-Cython python3-Jinja2
- python3-pkgconfig python3-setuptools python3-wheel"
+ python3-pkgconfig python3-setuptools python3-wheel
+ python3-gmpy2 python3-memory_allocator python3-numpy ecl
+ python3-cypari2 python3-cysignals python3-devel"
 makedepends="boost-devel brial-devel cliquer-devel ecl eclib-devel
  ecm-devel fflas-ffpack flintlib-devel gap-devel gd-devel giac-devel glpk-devel
  gsl-devel iml-devel lcalc-devel libbraiding-devel libhomfly-devel libmpc-devel

tornaria avatar Dec 24 '24 21:12 tornaria

Yes, that should be enough. I tried to build and check on it aarch64: it fails only one test sage/rings/number_theory/galois_group.py. After installing sage, I cannot run it though, I get

/usr/bin/sage: line 177: /usr/libexec/sagemath/sage-env-config: Permission denied
/usr/bin/sage: line 916: exec: sage-runtests: not found

dkwo avatar Dec 26 '24 18:12 dkwo

Yes, that should be enough.

:+1: I pushed that change here.

I tried to build and check on it aarch64: it fails only one test sage/rings/number_theory/galois_group.py.

Nice, at some point we may want to debug that so tests pass. Can you post the failure?

After installing sage, I cannot run it though, I get

/usr/bin/sage: line 177: /usr/libexec/sagemath/sage-env-config: Permission denied
/usr/bin/sage: line 916: exec: sage-runtests: not found

That's weird. The second error is expected from the first (because sage-env-config sets the correct PATH so if it doesn't run the PATH is incorrect).

What's up with sage-env-config? I don't make it +x but it should not be necessary as line 177 sources it. Am I missing something? Here:

$ ls -l /usr/libexec/sagemath/
total 252
-rwxr-xr-x 1 root root   785 Dec 25 19:20 math-readline
-rwxr-xr-x 1 root root 43267 Dec 25 19:20 sage
-rwxr-xr-x 1 root root   651 Dec 25 19:20 sage-cachegrind
-rwxr-xr-x 1 root root   442 Dec 25 19:20 sage-callgrind
-rwxr-xr-x 1 root root  7788 Dec 25 19:20 sage-cleaner
-rwxr-xr-x 1 root root 10209 Dec 25 19:20 sage-coverage
-rwxr-xr-x 1 root root  1356 Dec 25 19:20 sage-cython
-rwxr-xr-x 1 root root 23416 Dec 25 19:20 sage-env
-rw-r--r-- 1 root root   205 Dec 25 19:20 sage-env-config
-rwxr-xr-x 1 root root   238 Dec 25 19:20 sage-eval
-rwxr-xr-x 1 root root 35314 Dec 25 19:20 sage-fixdoctests
-rwxr-xr-x 1 root root   119 Dec 25 19:20 sage-grep
-rwxr-xr-x 1 root root    70 Dec 25 19:20 sage-grepdoc
-rwxr-xr-x 1 root root   234 Dec 25 19:20 sage-inline-fortran
-rwxr-xr-x 1 root root  1345 Dec 25 19:20 sage-ipynb2rst
-rwxr-xr-x 1 root root   352 Dec 25 19:20 sage-ipython
-rwxr-xr-x 1 root root  3660 Dec 25 19:20 sage-list-packages
-rwxr-xr-x 1 root root   613 Dec 25 19:20 sage-massif
-rwxr-xr-x 1 root root  8463 Dec 25 19:20 sage-notebook
-rwxr-xr-x 1 root root  3138 Dec 25 19:20 sage-num-threads.py
-rwxr-xr-x 1 root root   595 Dec 25 19:20 sage-omega
-rwxr-xr-x 1 root root 10605 Dec 25 19:20 sage-preparse
-rwxr-xr-x 1 root root    28 Dec 25 19:20 sage-python
-rwxr-xr-x 1 root root   699 Dec 25 19:20 sage-run
-rwxr-xr-x 1 root root   245 Dec 25 19:20 sage-run-cython
-rwxr-xr-x 1 root root   121 Dec 25 19:20 sage-runtests
-rwxr-xr-x 1 root root  6219 Dec 25 19:20 sage-startuptime.py
-rwxr-xr-x 1 root root  5646 Dec 25 19:20 sage-update-version
-rwxr-xr-x 1 root root  1201 Dec 25 19:20 sage-valgrind
-rwxr-xr-x 1 root root  1207 Dec 25 19:20 sage-venv-config
-rwxr-xr-x 1 root root   394 Dec 25 19:20 sage-version.sh

tornaria avatar Dec 26 '24 20:12 tornaria

For me, that file is only readable to root:

$ ls -l /usr/libexec/sagemath/ 
total 252
-rwxr-xr-x 1 root root   785 Dec 26 17:58 math-readline
-rwxr-xr-x 1 root root 43267 Dec 26 17:58 sage
-rwxr-xr-x 1 root root   651 Dec 26 17:58 sage-cachegrind
-rwxr-xr-x 1 root root   442 Dec 26 17:58 sage-callgrind
-rwxr-xr-x 1 root root  7788 Dec 26 17:58 sage-cleaner
-rwxr-xr-x 1 root root 10209 Dec 26 17:58 sage-coverage
-rwxr-xr-x 1 root root  1356 Dec 26 17:58 sage-cython
-rwxr-xr-x 1 root root 23416 Dec 26 17:58 sage-env
-rw------- 1 root root   205 Dec 26 17:58 sage-env-config
-rwxr-xr-x 1 root root   238 Dec 26 17:58 sage-eval
-rwxr-xr-x 1 root root 35314 Dec 26 17:58 sage-fixdoctests
-rwxr-xr-x 1 root root   119 Dec 26 17:58 sage-grep
-rwxr-xr-x 1 root root    70 Dec 26 17:58 sage-grepdoc
-rwxr-xr-x 1 root root   234 Dec 26 17:58 sage-inline-fortran
-rwxr-xr-x 1 root root  1345 Dec 26 17:58 sage-ipynb2rst
-rwxr-xr-x 1 root root   352 Dec 26 17:58 sage-ipython
-rwxr-xr-x 1 root root  3660 Dec 26 17:58 sage-list-packages
-rwxr-xr-x 1 root root   613 Dec 26 17:58 sage-massif
-rwxr-xr-x 1 root root  8463 Dec 26 17:58 sage-notebook
-rwxr-xr-x 1 root root  3138 Dec 26 17:58 sage-num-threads.py
-rwxr-xr-x 1 root root   595 Dec 26 17:58 sage-omega
-rwxr-xr-x 1 root root 10605 Dec 26 17:58 sage-preparse
-rwxr-xr-x 1 root root    28 Dec 26 17:58 sage-python
-rwxr-xr-x 1 root root   699 Dec 26 17:58 sage-run
-rwxr-xr-x 1 root root   245 Dec 26 17:58 sage-run-cython
-rwxr-xr-x 1 root root   121 Dec 26 17:58 sage-runtests
-rwxr-xr-x 1 root root  6219 Dec 26 17:58 sage-startuptime.py
-rwxr-xr-x 1 root root  5646 Dec 26 17:58 sage-update-version
-rwxr-xr-x 1 root root  1201 Dec 26 17:58 sage-valgrind
-rwxr-xr-x 1 root root  1207 Dec 26 17:58 sage-venv-config
-rwxr-xr-x 1 root root   394 Dec 26 17:58 sage-version.sh

dkwo avatar Dec 27 '24 20:12 dkwo

If I chmod it by hand, then everything works and that test fails like this:

Running doctests with ID 2024-12-27-21-07-26-dc66dad2.
Running with SAGE_LOCAL='/usr' and SAGE_VENV='/usr'
Using --optional=pip,sage
Features to be detected: 4ti2,SAGE_SRC,benzene,bliss,buckygen,conway_polynomials,coxeter3,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_ellcurves,database_graphs,database_jones_numfield,database_knotinfo,dot2tex,dvipng,ecm,fpylll,fricas,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_guava,gap_package_hap,gap_package_polenta,gap_package_polycyclic,gap_package_qpa,gap_package_quagroup,gfan,giac,glucose,graphviz,imagemagick,info,ipython,jmol,jupymake,jupyter_sphinx,kenzo,kissat,latte_int,lrcalc_python,lrslib,mathics,matroid_database,mcqd,meataxe,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pycosat,pycryptosat,pynormaliz,pyparsing,python_igraph,requests,rpy2,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.braiding,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.giac,sage.libs.homfly,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.sat,sage.schemes,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,scipy,singular,sirocco,sloane_database,sphinx,symengine_py,sympy,tdlib,threejs,topcom
Doctesting 1 file.
sage -t --warn-long 5.0 --random-seed=338122519044229990874824510482622064820 /usr/lib/python3.13/site-packages/sage/rings/number_field/galois_group.py
**********************************************************************
File "/usr/lib/python3.13/site-packages/sage/rings/number_field/galois_group.py", line 997, in sage.rings.number_field.galois_group.GaloisGroup_v2.artin_symbol
Failed example:
    [G.artin_symbol(P) for P in K.primes_above(7)]
Expected:
    [(1,5)(2,6)(3,7)(4,8), (1,5)(2,6)(3,7)(4,8),
     (1,4)(2,3)(5,8)(6,7), (1,4)(2,3)(5,8)(6,7)]
Got:
    [(1,4)(2,3)(5,8)(6,7),
     (1,4)(2,3)(5,8)(6,7),
     (1,5)(2,6)(3,7)(4,8),
     (1,5)(2,6)(3,7)(4,8)]
**********************************************************************
1 item had failures:
   1 of   8 in sage.rings.number_field.galois_group.GaloisGroup_v2.artin_symbol
    [295 tests, 1 failure, 0.80s wall]
----------------------------------------------------------------------
sage -t --warn-long 5.0 --random-seed=338122519044229990874824510482622064820 /usr/lib/python3.13/site-packages/sage/rings/number_field/galois_group.py  # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 1.6 seconds
    cpu time: 0.8 seconds
    cumulative wall time: 0.8 seconds
Features detected for doctesting: sage.groups,sage.rings.number_field,sage.symbolic

dkwo avatar Dec 27 '24 20:12 dkwo

it seems that's just an ordering issue?

dkwo avatar Dec 27 '24 20:12 dkwo

-rw------- 1 root root 205 Dec 26 17:58 sage-env-config

This probably means that the file in your void-packages repo is already 600 and we cp the file. There's a fair number of templates doing that, but most use vinstall.

I think we can do something like:

--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -51,7 +51,7 @@ post_install() {
        mv -T ${DESTDIR}/usr/bin ${DESTDIR}/usr/libexec/sagemath
 
        # copy configuration
-       cp ${FILESDIR}/sage-env-config ${DESTDIR}/usr/libexec/sagemath
+       vinstall ${FILESDIR}/sage-env-config 644 usr/libexec/sagemath
 
        # symlink main binary
        vmkdir usr/bin

to make sure the permissions are 644 regardless.

tornaria avatar Dec 27 '24 20:12 tornaria

it seems that's just an ordering issue?

Yes, I'll try to adjust so the ordering doesn't affect the test.

tornaria avatar Dec 27 '24 20:12 tornaria

@dkwo both issues should be fixed now :crossed_fingers:

tornaria avatar Dec 27 '24 20:12 tornaria

Thanks a lot! Everything works for me now on aarch64. cc @leahneukirchen

dkwo avatar Dec 28 '24 13:12 dkwo