Bug 2333363

Summary: pygrib needs to be rebuilt against NumPy 2.x
Product: [Fedora] Fedora Reporter: Sandro <gui1ty>
Component: pygribAssignee: Jos de Kloe <josdekloe>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: josdekloe, orion
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-12-26 14:29:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2332159    

Description Sandro 2024-12-19 16:39:26 UTC
Currently, importing pygrib results in:

>>> import pygrib
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import pygrib
  File "/usr/lib64/python3.13/site-packages/pygrib/__init__.py", line 2, in <module>
    from ._pygrib import *
  File "src/pygrib/_pygrib.pyx", line 1, in init pygrib._pygrib
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

A simple bump and rebuild should fix that.

Reproducible: Always

Comment 1 Orion Poplawski 2024-12-21 05:08:33 UTC
pygrib is failing to build with a test failure:

Trying:
    latsubset.min(),latsubset.max(),lonsubset.min(),lonsubset.max()
Expecting:
    (15.0, 65.0, 220.0, 320.0)
**********************************************************************
File "/home/orion/fedora/pygrib/pygrib-2.1.6-build/pygrib-f52c4cb4b10672f2400774524be01f45fbc004a2-tmp-test/test/test.py", line 207, in __main__.test
Failed example:
    latsubset.min(),latsubset.max(),lonsubset.min(),lonsubset.max()
Expected:
    (15.0, 65.0, 220.0, 320.0)
Got:
    (np.float64(15.0), np.float64(65.0), np.float64(220.0), np.float64(320.0))

I reported that upstream.

Comment 2 Sandro 2024-12-25 19:14:32 UTC
For now we can just revert to the old representation of scalars using `np.set_printoptions(legacy="1.25")` [1]. I've submitted PRs upstream and downstream.

[1] https://numpy.org/doc/2.2/release/2.0.0-notes.html#representation-of-numpy-scalars-changed