GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BUG: `SeedSequence` backwards/forwards compatibility check · Issue #33244 · numpy/numpy

BUG: SeedSequence backwards/forwards compatibility check #33244

New issue
Copy link
New issue
Copy link
Closed
#33263
Closed
BUG: SeedSequence backwards/forwards compatibility check#33244
#33263
Copy link
Labels
00 - Bugcomponent: numpy.random
Milestone
2.5.5 release

Description

@tylerjereddy
tylerjereddy
opened on Nov 7, 2026
Issue body actions

For now, this is a query. My question is--was this an intentional decision from the core team? Following gh-32889, in the numpy/random/bit_generator.pxd header file, it looks like the size of the struct that will get allocated for SeedSequence has increased a bit because of the addition of a _lock object there.

Reading through a subset of the review comments in that PR manually, I saw that considerable attention went into pickle compatibility concerns, but from a quick scan, I don't think I saw much discussion about forward/backward compatibility at runtime.

The reason I'm bringing this up is that I've been seeing CI failures for SciPy when building against recent NumPy main and then performing tests after rolling back to our lowest support NumPy version (2.0.0).

I can reproduce the failures locally on ARM Mac with a relatively simple sequence of steps (below).

  1. Build SciPy main against NumPy main.
  2. Downgrade NumPy in this environment to 2.0.0.
  3. Run spin test --no-build -t scipy/stats/tests/test_sampling.py

The errors I see locally match those that are showing up in our CI. In short, it is SeedSequence size changed, may indicate binary incompatibility. Expected 72 from C header, got 64 from PyObject. A sample full traceback is below the fold.

Details
______________________________________________ ERROR collecting build-install/usr/lib/python3.12/site-packages/scipy/stats/tests/test_sampling.py _______________________________________________
scipy/stats/tests/test_sampling.py:14: in <module>
    from scipy.stats.sampling import (
        IS_WASM    = False
        __builtins__ = <builtins>
        __cached__ = '/Users/treddy/github_projects/scipy/build-install/usr/lib/python3.12/site-packages/scipy/stats/tests/__pycache__/test_sampling.cpython-312.pyc'
        __doc__    = None
        __file__   = '/Users/treddy/github_projects/scipy/build-install/usr/lib/python3.12/site-packages/scipy/stats/tests/test_sampling.py'
        __loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x100a9f950>
        __name__   = 'scipy.stats.tests.test_sampling'
        __package__ = 'scipy.stats.tests'
        __spec__   = ModuleSpec(name='scipy.stats.tests.test_sampling', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at .../Users/treddy/github_projects/scipy/build-install/usr/lib/python3.12/site-packages/scipy/stats/tests/test_sampling.py')
        assert_allclose = <function assert_allclose at 0x10379eb60>
        assert_equal = <function assert_equal at 0x10379dc60>
        deepcopy   = <function deepcopy at 0x1008f5440>
        math       = <module 'math' from '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/math.cpython-312-darwin.so'>
        np         = <module 'numpy' from '/Users/treddy/python_venvs/py_312_scipy_dev/lib/python3.12/site-packages/numpy/__init__.py'>
        pickle     = <module 'pickle' from '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/pickle.py'>
        platform   = <module 'platform' from '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/platform.py'>
        pytest     = <module 'pytest' from '/Users/treddy/python_venvs/py_312_scipy_dev/lib/python3.12/site-packages/pytest/__init__.py'>
        sys        = <module 'sys' (built-in)>
        threading  = <module 'threading' from '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py'>
        warnings   = <module 'warnings' from '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/warnings.py'>
scipy/stats/sampling.py:59: in <module>
    from ._sampling import FastGeneratorInversion, RatioUniforms
        __builtins__ = <builtins>
        __cached__ = '/Users/treddy/github_projects/scipy/build-install/usr/lib/python3.12/site-packages/scipy/stats/__pycache__/sampling.cpython-312.pyc'
        __doc__    = '\n======================================================\nRandom Number Generators (:mod:`scipy.stats.sampling`)\n===...the following functionality can be used:\n\n.. autosummary::\n   :toctree: generated/\n\n   FastGeneratorInversion\n\n'
        __file__   = '/Users/treddy/github_projects/scipy/build-install/usr/lib/python3.12/site-packages/scipy/stats/sampling.py'
        __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x1075097c0>
        __name__   = 'scipy.stats.sampling'
        __package__ = 'scipy.stats'
        __spec__   = ModuleSpec(name='scipy.stats.sampling', loader=<_frozen_importlib_external.SourceFileLoader object at 0x1075097c0>, origin='/Users/treddy/github_projects/scipy/build-install/usr/lib/python3.12/site-packages/scipy/stats/sampling.py')
scipy/stats/_sampling.py:8: in <module>
    from ._unuran.unuran_wrapper import NumericalInversePolynomial
        Halton     = <class 'scipy.stats._qmc.Halton'>
        QMCEngine  = <class 'scipy.stats._qmc.QMCEngine'>
        __builtins__ = <builtins>
        __cached__ = '/Users/treddy/github_projects/scipy/build-install/usr/lib/python3.12/site-packages/scipy/stats/__pycache__/_sampling.cpython-312.pyc'
        __doc__    = None
        __file__   = '/Users/treddy/github_projects/scipy/build-install/usr/lib/python3.12/site-packages/scipy/stats/_sampling.py'
        __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x10750a6f0>
        __name__   = 'scipy.stats._sampling'
        __package__ = 'scipy.stats'
        __spec__   = ModuleSpec(name='scipy.stats._sampling', loader=<_frozen_importlib_external.SourceFileLoader object at 0x10750a6f0>, origin='/Users/treddy/github_projects/scipy/build-install/usr/lib/python3.12/site-packages/scipy/stats/_sampling.py')
        check_random_state_qmc = <function check_random_state at 0x106cc60c0>
        math       = <module 'math' from '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/math.cpython-312-darwin.so'>
        np         = <module 'numpy' from '/Users/treddy/python_venvs/py_312_scipy_dev/lib/python3.12/site-packages/numpy/__init__.py'>
        numbers    = <module 'numbers' from '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/numbers.py'>
        sc         = <module 'scipy.special' from '/Users/treddy/github_projects/scipy/build-install/usr/lib/python3.12/site-packages/scipy/special/__init__.py'>
        stats      = <module 'scipy.stats' from '/Users/treddy/github_projects/scipy/build-install/usr/lib/python3.12/site-packages/scipy/stats/__init__.py'>
scipy/stats/_unuran/unuran_wrapper.pyx:1: in init scipy.stats._unuran.unuran_wrapper
    ???
E   ValueError: numpy.random.bit_generator.SeedSequence size changed, may indicate binary incompatibility. Expected 72 from C header, got 64 from PyObject

Activity

  1. tylerjereddy
    added
    33 - QuestionQuestion about NumPy usage or development
    on Nov 7, 2026
  2. tylerjereddy commented on Nov 7, 2026

    @tylerjereddy
    tylerjereddy
    on Nov 7, 2026
    ContributorAuthor
    More actions

    I believe this would make all versions of NumPy prior to 2.6.0 incompatible with a SciPy built against that NumPy version, so my guess would be that you might not want to do that, but maybe I don't understand.

  3. charris commented on Nov 7, 2026

    @charris
    charris
    on Nov 7, 2026
    Member
    More actions

    Hmm, agree that is a problem.

  4. charris commented on Nov 7, 2026

    @charris
    charris
    on Nov 7, 2026
    Member
    More actions

    Note that this change was backported for 2.5.5, so that might need fixing as well. I'll wait on resolution.

    EDIT: I might just revert it.

  5. charris
    added this to the 2.5.5 release milestone on Nov 7, 2026
  6. tylerjereddy
    changed the title [-]Query: `SeedSequence` backwards/forwards compatibility check[/-] [+]BUG: `SeedSequence` backwards/forwards compatibility check[/+] on Nov 7, 2026
  7. tylerjereddy
    added
    00 - Bug
    component: numpy.random
    and removed
    33 - QuestionQuestion about NumPy usage or development
    on Nov 7, 2026
  8. charris commented on Nov 9, 2026

    @charris
    charris
    on Nov 9, 2026
    Member
    More actions

    @ngoldbaum Ping.

  9. ngoldbaum commented on Nov 9, 2026

    @ngoldbaum
    ngoldbaum
    on Nov 9, 2026
    Member
    More actions

    Ah darn, I think that means we might need to revert that PR and give it another go. Ping @shbhmbnsl1.

    Reacted by Shubham Bansal
  10. ngoldbaum commented on Nov 9, 2026

    @ngoldbaum
    ngoldbaum
    on Nov 9, 2026
    Member
    More actions

    Sorry, I didn't appreciate SciPy used that struct.

  11. shbhmbnsl1 commented on Nov 9, 2026

    @shbhmbnsl1
    shbhmbnsl1
    on Nov 9, 2026
    Contributor
    More actions

    Apologies, my focus was to test whether saved objects could be restored in backward versions but didn't check Scipy's compatibility. Here is a quick revert PR for this - #33263
    We can talk about fixing the original bug with some alternate approach.

  12. ngoldbaum
    closed this as completedin #33263on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    00 - Bugcomponent: numpy.random

    Type

    No type

    Projects

    No projects

      Milestone

      • 2.5.5 release

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.