From aac52c49def3847b85bfa6a297dbc8f109e6b851 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Fri, 7 Jun 2024 15:37:49 -0500 Subject: [PATCH] Update aksetup --- aksetup_helper.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/aksetup_helper.py b/aksetup_helper.py index 8c9bcec..57e82eb 100644 --- a/aksetup_helper.py +++ b/aksetup_helper.py @@ -43,14 +43,21 @@ def setup(*args, **kwargs): def get_numpy_incpath(): - from os.path import join, dirname + from os.path import join, dirname, exists from importlib.util import find_spec origin = find_spec("numpy").origin if origin is None: raise RuntimeError("origin of numpy package not found") pathname = dirname(origin) - return join(pathname, "core", "include") + for p in [ + join(pathname, "_core", "include"), # numpy 2 onward + join(pathname, "core", "include"), # numpy prior to 2 + ]: + if exists(join(p, "numpy", "arrayobject.h")): + return p + + raise RuntimeError("no valid path for numpy found") class NumpyExtension(Extension):