OK, it seems like a "# distutils: libraries = pari" at the top of the pyx 
file does the trick, as suggested by the cython docs. Still interested in 
hearing if it's a good idea to solve it like that.

On Monday, 12 January 2026 at 09:13:12 UTC-8 Nils Bruin wrote:

> I ran into an issue with https://github.com/nbruin/RiemannTheta where 
> installing it into modern sage completes without an error but where I get:
>
> sage: import riemann_theta.riemann_theta
> ImportError: 
> /usr/local/sage/sage-git/local/var/lib/sage/venv-python3.13/lib64/python3.13/site-packages/riemann_theta/
> riemann_theta.cpython-313-x86_64-linux-gnu.so: undefined symbol: pari_err
>
> Clearly, libpari doesn't get linked. Previously it did, so this is 
> probably due to some tightening of dependency determination in cython or 
> python's setup machinery.
>
> The setup.py for this project is below. This used to work. Is there an 
> obvious way in which I should change it? Particularly is there something 
> sage-specific that can help here? The package in question really depends 
> quite closely on a lot of sage so it would need to be built within its venv 
> anyway.
>
> --------------------------------------
> import setuptools
> from Cython.Build import cythonize
> import numpy
>
> with open("README.md", "r") as fh:
>     long_description = fh.read()
>
> setuptools.setup(
>     name='RiemannTheta',
>     version="1.0.0",
>     author="Nils Bruin, Sohrab Ganjian",
>     author_email="[email protected]",
>     license="GPL2+",
>     description="Evaluate Riemann Theta function numerically in Sagemath",
>     long_description=long_description,
>     long_description_content_type="text/markdown",
>     url="",
>     packages=setuptools.find_packages(),
>     ext_modules=cythonize("riemann_theta/riemann_theta.pyx"),
>     include_dirs=[numpy.get_include()],
>     zip_safe=False,
> )
> -----------------------------------------------
>
> I guess there need to be some "libraries" and possibly "library_dirs" 
> added to the config but hardcoding them is probably not a good idea. 
> Suggestions? (ChatGPT suggests running "pari-config" but I think it just 
> came up with that because it looked convenient)
>
> There may be other third party packages out there that quietly broke due 
> to some backwards incompatible changes in the python/sage build system.
>

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/5b7b0d27-58d4-46d8-96de-864d5d912af9n%40googlegroups.com.

Reply via email to