Thanks. As far as I understood, the setuptools way allowed "cythonize" to 
figure everything out for me, which meant I could use just some boilerplate 
setup.py. Is that now deprecated? That would be unfortunate. It would make 
packaging vanilla cython packages much harder.

On Monday, 12 January 2026 at 10:59:15 UTC-8 [email protected] wrote:

> You should follow the modern guidelines to specify the dependencies etc, 
> with pyproject.toml
> <https://packaging.python.org/en/latest/guides/section-build-and-publish/>
> AFAIK, # distutils tags in Cython header is
> the usual setuptools way.
>
> I would also say, switch from setuptools to meson or pybind11/nanobind
>
> Dima 
>
>
>
> On January 12, 2026 11:26:51 AM CST, Nils Bruin <[email protected]> wrote:
>
>> 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/0b461a48-36fe-4bac-926e-50559d5670b7n%40googlegroups.com.

Reply via email to