Skip to content

Binary incompatibility with Raysect when building with numpy 2.0 #442

Description

@vsnever

NumPy 2.0 was recently released. Although Cherab builds without errors with NumPy 2.0, trying to run any tests results in errors such as:

ImportError: Failed to import test module: cherab.core
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/unittest/loader.py", line 470, in _find_test_path
package = self._get_module_from_name(name)
File "/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/unittest/loader.py", line 377, in _get_module_from_name
__import__(name)
File "/home/runner/work/cherab-core/cherab-core/cherab/core/__init__.py", line 20, in <module>
from .atomic import *
File "/home/runner/work/cherab-core/cherab-core/cherab/core/atomic/__init__.py", line 22, in <module>
from .interface import AtomicData
File "cherab/core/atomic/interface.pyx", line 1, in init cherab.core.atomic.interface
# Copyright 2016-2022 Euratom
File "cherab/core/atomic/zeeman.pyx", line 1, in init cherab.core.atomic.zeeman
# Copyright 2016-2018 Euratom
File "/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/raysect/core/__init__.py", line 30, in <module>
from .ray import *
File "raysect/core/ray.pyx", line 1, in init raysect.core.ray
File "/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/raysect/core/math/__init__.py", line 39, in <module>
from .statsarray import StatsBin, StatsArray1D, StatsArray2D, StatsArray3D
File "raysect/core/math/statsarray.pyx", line 1, in init raysect.core.math.statsarray
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Looks like NumPy 2.0 is binary incompatible with NumPy 1.x, which Raysect is built against. Until we have Raysect binaries built with NumPy 2.0, I suggest limiting the NumPy version to 1.x in setup.py, requirements.txt and ci.yml.

Activity

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