nipy / nibabel

Python package to access a cacophony of neuro-imaging file formats
http://nipy.org/nibabel/
Other
649 stars 258 forks source link

Noisy UserWarning is thrown (`np.longdouble`) when importing `nibabel` with `numpy>=1.25` on WSL1 #1309

Closed joshuacwnewton closed 6 months ago

joshuacwnewton commented 6 months ago

[!NOTE] This seems to be a relatively narrow warning, since numpy<=1.24 doesn't throw this warning, nor does WSL2, nor does the native Windows package.

The warning thrown by numpy is:

numpy/core/getlimits.py:542:  
"""
UserWarning: Signature b'\x00\xd0\xcc\xcc\xcc\xcc\xcc\xcc\xfb\xbf\x00\x00\x00\x00\x00\x00' for 
<class 'numpy.longdouble'> does not match any known type: falling back to type probe function.
This warnings indicates broken support for the dtype!
  machar = _get_machar(dtype)
"""

When importing nibabel, the following stack trace occurs:

Reading the source code of best_float(), I see that nibabel actively tries to avoid np.longdouble on Windows:

https://github.com/nipy/nibabel/blob/0e925abb15e2dfbeecaaca4e7c2479b9d3e2cec0/nibabel/casting.py#L667-L670

Given nibabel's intentions here, it seems as though the warning is largely noise? So, I thought I would mention it here in case nibabel wishes to filter this warning.

Related issues:

effigies commented 6 months ago

Seems worth filtering. Any interest in proposing a patch?

joshuacwnewton commented 6 months ago

Sure thing! Feel free to assign me. :)