Skip to content

Commit aac52c4

Browse files
committed
Update aksetup
1 parent 0ed12f1 commit aac52c4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

aksetup_helper.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,21 @@ def setup(*args, **kwargs):
4343

4444

4545
def get_numpy_incpath():
46-
from os.path import join, dirname
46+
from os.path import join, dirname, exists
4747
from importlib.util import find_spec
4848
origin = find_spec("numpy").origin
4949
if origin is None:
5050
raise RuntimeError("origin of numpy package not found")
5151

5252
pathname = dirname(origin)
53-
return join(pathname, "core", "include")
53+
for p in [
54+
join(pathname, "_core", "include"), # numpy 2 onward
55+
join(pathname, "core", "include"), # numpy prior to 2
56+
]:
57+
if exists(join(p, "numpy", "arrayobject.h")):
58+
return p
59+
60+
raise RuntimeError("no valid path for numpy found")
5461

5562

5663
class NumpyExtension(Extension):

0 commit comments

Comments
 (0)