Optional packages in conda

174 views
Skip to first unread message

mmarco

unread,
Jun 26, 2026, 8:28:37 AM (5 days ago) Jun 26
to sage-devel
Now that the recommended way to install sage is through conda (which makes it way easy that compiling from source), I am having the problem with installing optional packages.

Some (like sirocco)  are already in conda-forge, so it is easy to install them, but in particular, I am being unable to install Tides and Kenzo.

Which should be the way to install them? Should we create packages in conda forge for them?

Isuru Fernando

unread,
Jun 26, 2026, 10:42:55 AM (4 days ago) Jun 26
to sage-...@googlegroups.com
Yes, having them in conda-forge is the recommended way.

Isuru

--
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/b653a3f9-3da4-4d19-b3cb-98b49b75a8e8n%40googlegroups.com.

mmarco

unread,
Jun 26, 2026, 10:57:51 AM (4 days ago) Jun 26
to sage-devel
How is the process to add a package to conda-forge?

mmarco

unread,
Jun 26, 2026, 11:01:40 AM (4 days ago) Jun 26
to sage-devel
Also, it might require changes in sage, to look for the corresponding files in the right place

Isuru Fernando

unread,
Jun 26, 2026, 11:08:47 AM (4 days ago) Jun 26
to sage-...@googlegroups.com
You can also ask your favourite AI model to give you the code for it.

Isuru

Dima Pasechnik

unread,
Jun 26, 2026, 11:41:25 AM (4 days ago) Jun 26
to sage-...@googlegroups.com, Miguel Angel Marco
On Fri, Jun 26, 2026 at 10:01 AM mmarco <miguel....@gmail.com> wrote:
>
> Also, it might require changes in sage, to look for the corresponding files in the right place

if one uses sage the distro, it will also need adding spkg-configure.m4 files.
But that's the only needed change, as these packages are not requiring
any extension modules,
and are loaded anyway, with runtime detection of their availability.
> To view this discussion visit https://groups.google.com/d/msgid/sage-devel/31bcb372-a978-444f-9c92-674057778fc3n%40googlegroups.com.

mmarco

unread,
Jun 26, 2026, 12:17:22 PM (4 days ago) Jun 26
to sage-devel
I meant that, for example, kenzo looks at the variable KENZO_FAS, which I think is not properly set when you install sage in conda-forge.  Tides depends on SAGE_LOCAL, which again, is not set in the conda-forge install. Would adding skpg-configure.m4 be enough to handle this?

Dima Pasechnik

unread,
Jun 26, 2026, 11:53:19 PM (4 days ago) Jun 26
to sage-...@googlegroups.com
On Fri, Jun 26, 2026 at 11:17 AM mmarco <miguel....@gmail.com> wrote:
>
> I meant that, for example, kenzo looks at the variable KENZO_FAS, which I think is not properly set when you install sage in conda-forge. Tides depends on SAGE_LOCAL, which again, is not set in the conda-forge install. Would adding skpg-configure.m4 be enough to handle this?

That's sort of a typical sage-distro insanity - doing settings for
Kenzo in the config of ecl
(sorry, Michael O. :-))
build/pkgs/ecl/spkg-configure.m4: AC_SUBST(SAGE_KENZO_FAS,
['${prefix}'/lib/ecl/kenzo.fas])

By right in should be in `build/pkgs/kenzo/spkg-configure.m4`

A quick hack is to get rid of all that KENZO_FAS spaghetti:
--- a/src/sage/features/kenzo.py
+++ b/src/sage/features/kenzo.py
@@ -62,11 +62,7 @@ class Kenzo(Feature):
ecl_eval("(setf *standard-output* *dev-null*)")

try:
- from sage.env import KENZO_FAS
- if KENZO_FAS:
- ecl_eval("(require :kenzo \"{}\")".format(KENZO_FAS))
- else:
- ecl_eval("(require :kenzo)")
+ ecl_eval("(require :kenzo)")

except RuntimeError:
return FeatureTestResult(self, False, reason="Unable to
make ECL require kenzo")
diff --git a/src/sage/interfaces/kenzo.py b/src/sage/interfaces/kenzo.py
index 8a90f0c424b..e1b3afde5d6 100644
--- a/src/sage/interfaces/kenzo.py
+++ b/src/sage/interfaces/kenzo.py
@@ -104,11 +104,7 @@ kenzo_names = ['add',
# example __sphere__ is defined as EclObject("sphere"). Hyphens
# are replaced with underscores to get valid Python identifiers.
if Kenzo().is_present():
- from sage.env import KENZO_FAS
- if KENZO_FAS:
- ecl_eval("(require :kenzo \"{}\")".format(KENZO_FAS))
- else:
- ecl_eval("(require :kenzo)")
+ ecl_eval("(require :kenzo)")

ecl_eval("(in-package :cat)")
ecl_eval("(setf *HOMOLOGY-VERBOSE* nil)")

and symlink kenzo.fas to where ecl finds its .fas files, namely, to
what's being output by

./sage --ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)"

That is,

ln -s `pwd`/local/lib/ecl/kenzo.fas $(./sage --ecl -eval "(princ
(SI:GET-LIBRARY-PATHNAME))" -eval "(quit)")


------------------

As a matter of fact, ecl can be configured to search for .fas files in
particular directories.
This something we discussed (and discussed, and discussed... :-)) with upstream
on https://gitlab.com/embeddable-common-lisp/ecl/-/work_items/846
I just submitted a fix along these lines to Homebrew.
https://github.com/Homebrew/homebrew-core/pull/290044
Once it's in, Homebrew tap "dimpase/tap/maxima-ecl" will work together with ecl,
(so that "(require :maxima)" works out of the box)

I'll write a Kenzo Homebrew formula, it's shouldn't be hard, modelling
after dimpase/tap/maxima-ecl
(i.e. https://github.com/dimpase/homebrew-tap/blob/main/Formula/m/maxima-ecl.rb)


HTH
Dima


Dima
> To view this discussion visit https://groups.google.com/d/msgid/sage-devel/35f5f564-f36e-4f59-84c7-c4b7570ab17an%40googlegroups.com.

mmarco

unread,
Jun 28, 2026, 1:41:20 PM (2 days ago) Jun 28
to sage-devel
The KENZO_FAS code is in fact broken:

```
sage: from sage.env import KENZO_FAS
sage: KENZO_FAS
"'/home/mmarco/sage/local/var/lib/sage/venv-python3.14'/lib/ecl/kenzo.fas"
```

Trying to load it in ecl fails because of the inserted '

```
sage: from sage.libs.ecl import ecl_eval
sage: ecl_eval("(require :kenzo \"{}\")".format(KENZO_FAS))
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[4], line 1
----> 1 ecl_eval("(require :kenzo \"{}\")".format(KENZO_FAS))

File sage/libs/ecl.pyx:1334, in sage.libs.ecl.ecl_eval()
-> 1334 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:1361, in sage.libs.ecl.ecl_eval()
-> 1361 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:1357, in sage.libs.ecl.ecl_eval()
-> 1357 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:324, in sage.libs.ecl.ecl_safe_eval()
--> 324 'Could not get source, probably due dynamically evaluated source code.'

RuntimeError: ECL says: Cannot open #P"/home/mmarco/sage/'/home/mmarco/sage/local/var/lib/sage/venv-python3.14'/lib/ecl/kenzo.fas".
C library error: No such file or directory
while evaluating (require :kenzo "'/home/mmarco/sage/local/var/lib/sage/venv-python3.14'/lib/ecl/kenzo.fas")

```

But loading directly kenzo fails too:

```

sage: ecl_eval("(require :kenzo)")
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[5], line 1
----> 1 ecl_eval("(require :kenzo)")

File sage/libs/ecl.pyx:1334, in sage.libs.ecl.ecl_eval()
-> 1334 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:1361, in sage.libs.ecl.ecl_eval()
-> 1361 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:1357, in sage.libs.ecl.ecl_eval()
-> 1357 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:324, in sage.libs.ecl.ecl_safe_eval()
--> 324 'Could not get source, probably due dynamically evaluated source code.'

RuntimeError: ECL says: Module error: Don't know how to REQUIRE KENZO.
while evaluating (require :kenzo)
```

But it is even worse: the directory that is supposed to look at dosn't even exist:

````
sage: ecl_eval("(require :kenzo \"{}\")".format(KENZO_FAS.replace("'","")))
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[6], line 1
----> 1 ecl_eval("(require :kenzo \"{}\")".format(KENZO_FAS.replace("'","")))

File sage/libs/ecl.pyx:1334, in sage.libs.ecl.ecl_eval()
-> 1334 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:1361, in sage.libs.ecl.ecl_eval()
-> 1361 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:1357, in sage.libs.ecl.ecl_eval()
-> 1357 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:324, in sage.libs.ecl.ecl_safe_eval()
--> 324 'Could not get source, probably due dynamically evaluated source code.'

RuntimeError: ECL says: Cannot open #P"/home/mmarco/sage/local/var/lib/sage/venv-python3.14/lib/ecl/kenzo.fas".
C library error: No such file or directory
while evaluating (require :kenzo "/home/mmarco/sage/local/var/lib/sage/venv-python3.14/lib/ecl/kenzo.fas")```
```

The right one is just `local/lib/ecl` (not geting in the venv).

```
sage: ecl_eval('(require :kenzo "/home/mmarco/sage/local/lib/ecl/kenzo.fas")')
;;; Loading #P"/home/mmarco/sage/local/lib/ecl/kenzo.fas"
<ECL: ("finite-spaces-point-reductions" "finite-spaces-facets" "finite-spaces-hregularization" "finite-spaces-homology-dvf" "finite-spaces-homology" "finite-spaces-changes" "finite-spaces-subdivisions" "finite-
spaces-class" "pushout" "suspension2" ...)>

```

Dima Pasechnik

unread,
Jun 29, 2026, 12:29:09 AM (yesterday) Jun 29
to sage-...@googlegroups.com

> C library error: No such file or directory
> while evaluating (require :kenzo "'/home/mmarco/sage/local/var/lib/sage/venv-python3.14'/lib/ecl/kenzo.fas")

it's a malformed path, a spurious pair of "'"'s



Nils Bruin

unread,
Jun 29, 2026, 12:34:04 AM (yesterday) Jun 29
to sage-devel
Perhaps due to


or


There are extra ' ' there that can probably be removed (I'm not an expert in m4 or meson though, so someone more informed should check)

Dima Pasechnik

unread,
Jun 29, 2026, 3:01:38 AM (yesterday) Jun 29
to sage-...@googlegroups.com
On Sun, Jun 28, 2026 at 11:34 PM Nils Bruin <nbr...@sfu.ca> wrote:
>
> Perhaps due to
>
> https://github.com/sagemath/sage/blob/81bbb448a101400d3ac58ffe536dbbb2cac3f950/src/sage/meson.build#L21
>
> or
>
> https://github.com/sagemath/sage/blob/81bbb448a101400d3ac58ffe536dbbb2cac3f950/build/pkgs/ecl/spkg-configure.m4#L40
>
> There are extra ' ' there that can probably be removed (I'm not an expert in m4 or meson though, so someone more informed should check)

try

--- a/src/sage/meson.build
+++ b/src/sage/meson.build
@@ -18,7 +18,7 @@ if not fs.exists(datadir / 'cremona')
)
endif
# Kenzo cannot yet be provided by the system, so we always use the
SAGE_LOCAL path for now.
-conf_data.set('SAGE_KENZO_FAS', '\'${prefix}\'/lib/ecl/kenzo.fas')
+conf_data.set('SAGE_KENZO_FAS', '${prefix}/lib/ecl/kenzo.fas')
# It can be found, so we don't have to set anything here:
conf_data.set('NTL_INCDIR', '')
conf_data.set('NTL_LIBDIR', '')


I don't think SAGE_KENZO_FAS settings in
build/pkgs/ecl/spkg-configure.m4 actually have any effect.

Dima
> To view this discussion visit https://groups.google.com/d/msgid/sage-devel/f38aef32-c98b-41d9-8c97-5b8b47118a9an%40googlegroups.com.

mmarco

unread,
Jun 29, 2026, 5:27:25 AM (yesterday) Jun 29
to sage-devel
${prefix} will be the directory inside the venv, right? That is not where the kenzo.fas file is copied when installing the kenzo package

Dima Pasechnik

unread,
Jun 29, 2026, 12:52:18 PM (yesterday) Jun 29
to sage-...@googlegroups.com
On Mon, Jun 29, 2026 at 4:27 AM mmarco <miguel....@gmail.com> wrote:
>
> ${prefix} will be the directory inside the venv, right?
No, that's "prefix", not "$prefix".
The latter is something to be dealt with in src/sage/config.py.in:

KENZO_FAS = "@SAGE_KENZO_FAS@".replace("${prefix}", SAGE_LOCAL)

which becomes

KENZO_FAS = "'${prefix}'/lib/ecl/kenzo.fas".replace("${prefix}", SAGE_LOCAL)

in build/sage-distro/src/sage/config.py


> That is not where the kenzo.fas file is copied when installing the kenzo package

kenzo.fas is installed into local/lib/ecl/

This is supposed to be set correctly by src/sage/config.py


Now, we can actually see what's going on:

KENZO_FAS = "'${prefix}'/lib/ecl/kenzo.fas".replace("${prefix}", SAGE_LOCAL)
sage: KENZO_FAS
"'/Users/dima/software/sage-distro/local'/lib/ecl/kenzo.fas"
sage: from sage.libs.ecl import ecl_eval
sage: ecl_eval('(require :kenzo '+'"'+KENZO_FAS+'")')
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[40], line 1
----> 1 ecl_eval('(require :kenzo '+'"'+KENZO_FAS+'")')

File sage/libs/ecl.pyx:1334, in sage.libs.ecl.ecl_eval()
-> 1334 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:1361, in sage.libs.ecl.ecl_eval()
-> 1361 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:1357, in sage.libs.ecl.ecl_eval()
-> 1357 'Could not get source, probably due dynamically evaluated source code.'

File sage/libs/ecl.pyx:324, in sage.libs.ecl.ecl_safe_eval()
--> 324 'Could not get source, probably due dynamically evaluated source code.'

RuntimeError: ECL says: Cannot open
#P"/Users/dima/software/sage-distro/'/Users/dima/software/sage-distro/local'/lib/ecl/kenzo.fas".
C library error: No such file or directory
while evaluating (require :kenzo
"'/Users/dima/software/sage-distro/local'/lib/ecl/kenzo.fas")


Now, let's remove these extra "'":

sage: KENZO_FAS = "${prefix}/lib/ecl/kenzo.fas".replace("${prefix}", SAGE_LOCAL)
sage: KENZO_FAS
'/Users/dima/software/sage-distro/local/lib/ecl/kenzo.fas'
sage: ecl_eval('(require :kenzo '+'"'+KENZO_FAS+'")')
;;; Loading #P"/Users/dima/software/sage-distro/local/lib/ecl/kenzo.fas"
<ECL: NIL>

It works!

So it appears that my diagnosis - spurious "'"-s - was right all along.

Dima
> To view this discussion visit https://groups.google.com/d/msgid/sage-devel/5fba4910-feb3-4383-8d00-180810d8b5f0n%40googlegroups.com.

Dima Pasechnik

unread,
Jun 29, 2026, 12:52:25 PM (yesterday) Jun 29
to sage-...@googlegroups.com
Now I'm trying to produce a fix.
Can anyone please explain why the following is happening in sage distro:

sage: SAGE_LOCAL
'/Users/dima/software/sage-distro/local'
sage: from sage.config import SAGE_LOCAL
sage: SAGE_LOCAL
'/Users/dima/software/sage-distro/local/var/lib/sage/venv-python3.14'
sage:

Why does SAGE_LOCAL have two totally different meanings?
How does it make any sense?

Dima

Michael Orlitzky

unread,
Jun 29, 2026, 2:07:57 PM (yesterday) Jun 29
to sage-...@googlegroups.com
On 2026-06-29 11:45:18, Dima Pasechnik wrote:
>
> Why does SAGE_LOCAL have two totally different meanings?
> How does it make any sense?

I don't know about making sense, but sage.env imports sage.config, and
then re-declares SAGE_LOCAL = var("SAGE_LOCAL"). That eventually
checks sage.config, but allows the environment to override it.

Dima Pasechnik

unread,
Jun 29, 2026, 4:56:08 PM (yesterday) Jun 29
to sage-...@googlegroups.com
rewritting of {prefix} in KENZO_FAS happens in sage.config, after redefining SAGE_LOCAL to a meaningless value.

Yes, one can spaghetti-code around it,
but it's concerning.


>

Tobia...@gmx.de

unread,
Jun 29, 2026, 5:13:55 PM (yesterday) Jun 29
to sage-devel
Yes, kenzo and tides don't have a built-time detection in the meson.build files. This would need to be done after those packages are on conda-forge. For kenzo, this could be modeled on https://github.com/sagemath/sage/blob/81bbb448a101400d3ac58ffe536dbbb2cac3f950/src/sage/libs/meson.build#L18-L74.

mmarco

unread,
Jun 29, 2026, 6:37:39 PM (yesterday) Jun 29
to sage-devel

Dima Pasechnik

unread,
3:40 AM (19 hours ago) 3:40 AM
to sage-...@googlegroups.com
should be fixed by https://github.com/sagemath/sage/pull/42461

On Mon, Jun 29, 2026 at 5:07 PM Dima Pasechnik <dim...@gmail.com> wrote:
>
> What does it have to do with conda-forge?
> A kenzo package on conda can simply install kenzo.fas into the corresponding directory of ecl,
> like it's done for maxima (and maxima.fas).
>
> Kenzo is broken on sage-distro.
Reply all
Reply to author
Forward
0 new messages