Skip to content

np.long breaks choice(p=...) and permutation(int) on NumPy 1.26 #194

Open

Description

@vlad-perevezentsev

mkl_random/mklrand.pyx uses np.long at lines 2829, 2844 and 7100, but np.long does not exist in NumPy 1.24-1.26; it was only reintroduced in NumPy 2.0. The runtime floor in pyproject.toml is numpy >=1.26.4, so an installation satisfying our own requirements fails:

choice(5, 3, p=[0.2] * 5)   -> AttributeError: module 'numpy' has no attribute 'long'
permutation(5)              -> AttributeError: module 'numpy' has no attribute 'long'

CI does not catch this because its matrix starts at NumPy 2.2. Fix by replacing np.long with an explicit C-long dtype, or by raising the NumPy floor to 2.0.

Found during review of gh-192.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions