Skip to content

BUG: io.fits incompatibility with numpy 2.0 on Windows #16578

Closed

Description

@neutrinoceros

The problem was already known and linked within the code:

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)

Activity

  1. changed the title [-]BUG: io.fits incompatibility with numpy 2.0 on Windows[/-] [+]BUG: `io.fits` incompatibility with numpy 2.0 on Windows[/+] on Jun 17, 2024
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