Cython extension modules in optional spkgs

67 views
Skip to first unread message

Marc Culler

unread,
Jan 26, 2025, 12:50:57 PMJan 26
to sage-devel
In the venv of my recently built SageMath-10.6beta4 I find:
 % ls lib/python3.12/site-packages/sage/libs/coxeter3
__init__.py coxeter.pxd decl.pxd  __pycache__ coxeter.pyx
all__sagemath_coxeter3.py coxeter_group.py

In other subdirectories of sage/libs, such as flint, one finds that every .pyx file has an associated .so file in the same subdirectory.  So I would expect to find lib/python3.12/site-packages/sage/libs/coxeter3/coxeter-cpython-312-darwin.so, but it is not there.
That seems to suggest that coxeter.pyx is not being compiled by cython, and therefore that the extension module sage.libs.coxeter3.coxeter is not being built and hence is not installed. 

So it looks to me like the sagelib build process is skipping the step of cythonizing and compiling cython extension modules that are part of an optional package.

Am I missing some step which is needed for this to happen?  I have used the --enable-coxeter3 flag in the configure command.  Do I need to do something else?

- Marc


Marc Culler

unread,
Jan 26, 2025, 1:27:52 PMJan 26
to sage-devel
The coxeter3 package is not the only one. The optional packages meataxe and sirocco also have .pyx files with no associated .so file.  Those three are the only optional packages which appear in
 venv/lib/python3.12/site-packages/sage/libs
even though many other optional packages are enabled by my configure command.  I have no idea what would cause an optional package to be there.  But whatever the mechanism may be, it also seems to cause the extension module for such an optional package not to get built.

- Marc

Dima Pasechnik

unread,
Jan 26, 2025, 1:49:02 PMJan 26
to sage-...@googlegroups.com, Marc Culler
do you have anything in logs/pkgs/coxeter* ?
If not, and if you use the standard make build (not meson-based one) you may try

make coxeter3

and see how it goes.

Dima

>
> - Marc
>
>
> --
> 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 sage-devel+...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/sage-devel/0762e04b-33ba-4bfa-8ee4-e145163dd7f7n%40googlegroups.com.

Marc Culler

unread,
Jan 26, 2025, 2:03:42 PMJan 26
to sage-devel
Yes, I have a log file for coxeter3 which built fine.

The problem turned out to be that I had to use BOTH ---enable-coxeter3 AND -enable-sagemath_coxeter3.  With the latter option, the .so file gets build and installed as expected.

Why?  What is this about?  And why does the traceback tell our user to install the coxeter3 package when the coxeter3 package is installed already and what is really needed is the sagemath_coxeter3 package?

- Marc

Marc Culler

unread,
Jan 26, 2025, 2:24:14 PMJan 26
to sage-devel
Just to confirm, after I installed sagemath_coxeter3 the computation which was reported on sage-support as failing, and which produced the traceback saying that coxeter3 needed to be installed, now works fine:

┌─────────────────────────────────────────────┐
│ SageMath version 10.6.beta4, Release Date: 2025-01-18                                                                                 │
│ Using Python 3.12.5. Type "help()" for help.                                                                                                        │
└─────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.                                                                         ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: R.<v> = LaurentPolynomialRing(ZZ, 'v')
sage: W = CoxeterGroup('A3', implementation='coxeter3')
sage: H = IwahoriHeckeAlgebra(W, v**2); Cp=H.Cp()
sage: Cp.product_on_basis(W([1,2,1]), W([3,1]))
(v^-1+v)*Cp[1,2,1,3]
sage: Cp.product_on_basis(W([1,2,1]), W([3,1,2]))
(v^-1+v)*Cp[1,2,1,3,2] + (v^-1+v)*Cp[1,2,1]

- Marc

Marc Culler

unread,
Jan 26, 2025, 2:33:59 PMJan 26
to dim...@gmail.com, sage-...@googlegroups.com
OK.  But clearly it is a bug that the CoxeterGroup package raises:
  RuntimeError: coxeter3 must be installed
when coxeter3 *is* installed but sagemath_coxeter3 is not installed.

- Marc

On Sun, Jan 26, 2025 at 1:28 PM <dim...@gmail.com> wrote:
On Sun, Jan 26, 2025 at 11:03:42AM -0800, Marc Culler wrote:
> Yes, I have a log file for coxeter3 which built fine.
>
> The problem turned out to be that I had to use BOTH ---enable-coxeter3 AND
> -enable-sagemath_coxeter3.  With the latter option, the .so file gets build
> and installed as expected.
>
> Why?  What is this about?  And why does the traceback tell our user to
> install the coxeter3 package when the coxeter3 package is installed already
> and what is really needed is the sagemath_coxeter3 package?

coxeter3 is just a C++ library.
---- (cf. its SPKG.rst)
This package wraps Fokko Ducloux's Coxeter 3 C++ library
----


sagemath_coxeter3 is a Python inteface to it,
---- (cf. its SPKG.rst)
It provides a Cython interface to the ``coxeter3`` library.
----
so that's akin to fplll vs fpylll, only optional, so they aren't
installed by default. And yes, it's not an error to only install
coxeter3.

HTH
Dima

dim...@gmail.com

unread,
Jan 26, 2025, 2:37:01 PMJan 26
to sage-...@googlegroups.com, marc....@gmail.com
On Sun, Jan 26, 2025 at 11:03:42AM -0800, Marc Culler wrote:
> Yes, I have a log file for coxeter3 which built fine.
>
> The problem turned out to be that I had to use BOTH ---enable-coxeter3 AND
> -enable-sagemath_coxeter3. With the latter option, the .so file gets build
> and installed as expected.
>
> Why? What is this about? And why does the traceback tell our user to
> install the coxeter3 package when the coxeter3 package is installed already
> and what is really needed is the sagemath_coxeter3 package?

coxeter3 is just a C++ library.
---- (cf. its SPKG.rst)
This package wraps Fokko Ducloux's Coxeter 3 C++ library
----


sagemath_coxeter3 is a Python inteface to it,
---- (cf. its SPKG.rst)
It provides a Cython interface to the ``coxeter3`` library.
----
so that's akin to fplll vs fpylll, only optional, so they aren't
installed by default. And yes, it's not an error to only install
coxeter3.

HTH
Dima

>
> To view this discussion visit https://groups.google.com/d/msgid/sage-devel/097be2ad-5697-476b-b7cf-303a91359644n%40googlegroups.com.

signature.asc

Michael Orlitzky

unread,
Jan 26, 2025, 4:37:47 PMJan 26
to sage-...@googlegroups.com
On 2025-01-26 11:03:42, Marc Culler wrote:
> Yes, I have a log file for coxeter3 which built fine.
>
> The problem turned out to be that I had to use BOTH ---enable-coxeter3 AND
> -enable-sagemath_coxeter3. With the latter option, the .so file gets build
> and installed as expected.
>
> Why? What is this about?

This is one of the modularized-but-not-really packages. The code for
"sagemath_coxeter3" still lives in the sagelib source tree, and there
are a bunch of symlinks and #distutils magic comments and some custom
hacks in the sage-distro build system (and to cython) that let it
pretend like there's a separate sagemath_coxeter3 package, but there
isn't.

dim...@gmail.com

unread,
Jan 26, 2025, 4:45:15 PMJan 26
to Marc Culler, sage-...@googlegroups.com
On Sun, Jan 26, 2025 at 01:33:24PM -0600, Marc Culler wrote:
> OK. But clearly it is a bug that the CoxeterGroup package raises:
> RuntimeError: coxeter3 must be installed
> when coxeter3 *is* installed but sagemath_coxeter3 is not installed.

naming conventions...
Python package coxeter3 is installed by installing sagemath_coxeter3

Same issues with meataxe vs sagemath_meataxe, etc.

Indeed, it could be giving clearer advice on what to install on errors.
signature.asc
Reply all
Reply to author
Forward
0 new messages