scipy: BUG: `eval_hermite` is incompatible with NumPy 2.0 on Windows

Describe your issue.

python -c "import scipy.special, numpy as np;print(scipy.special.eval_hermite(np.arange(2), np.zeros((1,2), dtype=int)))"
  
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: ufunc 'eval_hermite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

One can create a GitHub Actions workflow to validate:

name: Test

on:
  push:

jobs:
  test:
    name: test scipy
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-python@v5
      with:
        python-version: "3.x"
    - run: pip install scipy
    - run: python -c "import scipy.special, numpy as np;print(scipy.special.eval_hermite(np.arange(2), np.zeros((1,2), dtype=int)))"

Reproducing Code Example

import scipy.special, numpy as np
print(scipy.special.eval_hermite(np.arange(2), np.zeros((1,2), dtype=int)))

Error message

TypeError: ufunc 'eval_hermite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

SciPy/NumPy/Python version and system information

scipy 1.14.0
numpy 2.0.0
python 3.12.4
Microsoft Windows Server 2022

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (19 by maintainers)

Most upvoted comments

I thought because this was only reported for eval_hermite that the issue only occured when the input type is long.

Update: Of the functions tested in the test_cython_api in special/tests/test_cython_special.py, eval_hermite and eval_hermitenorm are the only ones where the only type defined for a certain input is long. All the other ufuncs with int or long inputs also handle double for the same input, so when they are given a 64 bit integer type on a platform where long is 32 bit, the input is cast to double.