Repository navigation
Closed
Description
The problem was already known and linked within the code:
astropy/astropy/io/fits/hdu/hdulist.py
Lines 1509 to 1526 in 4d034aa
| if sys.platform.startswith("win"): | |
| # On Windows, all the original data mmaps were closed above. | |
| # However, it's possible that the user still has references to | |
| # the old data which would no longer work (possibly even cause | |
| # a segfault if they try to access it). This replaces the | |
| # buffers used by the original arrays with the buffers of mmap | |
| # arrays created from the new file. This seems to work, but | |
| # it's a flaming hack and carries no guarantees that it won't | |
| # lead to odd behavior in practice. Better to just not keep | |
| # references to data from files that had to be resized upon | |
| # flushing (on Windows--again, this is no problem on Linux). | |
| for idx, mmap, arr in mmaps: | |
| if mmap is not None: | |
| # https://github.com/numpy/numpy/issues/8628 | |
| with warnings.catch_warnings(): | |
| warnings.simplefilter("ignore", category=DeprecationWarning) | |
| arr.data = self[idx].data.data | |
| del mmaps # Just to be sure |
See: numpy/numpy#8628
What's changed is that this deprecation cycle was actually ended in numpy 2.0, but we didn't catch it before the final release because we didn't test pre-releases on windows.
Since resolution is rather urgent but the solution doesn't appear trivial, I'll just propose to pin numpy < 2.0 on windows for now, but this needs an actual resolution.
Originally posted by @neutrinoceros in #16575 (comment)
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]BUG: io.fits incompatibility with numpy 2.0 on Windows[/-][+]BUG: `io.fits` incompatibility with numpy 2.0 on Windows[/+]