Skip to content

Crashes with NumPy 2.4.0 #132

@maresb

Description

@maresb

Hey @zoj613, hope you've been well!

It appears that this package has been affected by a known bug in the latest 2.4.0 version of NumPy: scipy/scipy#24215.

micromamba list -n pymc-dev numpy
micromamba create -n polyagamma-numpy-failure -c conda-forge polyagamma numpy==2.4.0
micromamba activate polyagamma-numpy-failure
python -c "import polyagamma"

Result:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import polyagamma
  File "~/micromamba/envs/polyagamma-numpy-failure/lib/python3.14/site-packages/polyagamma/__init__.py", line 1, in <module>
    from ._polyagamma import (
    ...<3 lines>...
    )
  File "polyagamma/_polyagamma.pyx", line 1, in init polyagamma._polyagamma
AttributeError: module 'numpy.random.bit_generator' has no attribute 'SeedlessSequence'. Did you mean: 'SeedSequence'?

I'm not very proficient in C, so the following description is LLM-assisted:


Root Cause:

This was caused by numpy/numpy#30164, which fixed a typo in bit_generator.pxd by renaming an accidentally-defined empty class SeedlessSequence to the correct SeedlessSeedSequence.

However, Cython generates C code that declares all types from a .pxd file at import time, even if they're not actually used. This means removing/renaming any class from a .pxd file breaks ABI compatibility with packages compiled against older NumPy versions.

Fix Status:

The NumPy team has already merged a reversion in numpy/numpy#30500, which restores the SeedlessSequence symbol for backward compatibility. This fix is targeted for NumPy 2.4.1.

As of today (Jan 6, 2026), NumPy 2.4.1 has not yet been released, and 2.4.0 has not been yanked from PyPI.


It seems to me like, at least for conda-forge, we could solve this by blocking polyagamma from being installed with NumPy 2.4.0. Then hopefully once 2.4.1 is released it will be compatible again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions