Skip to content

Commit c562b9e

Browse files
committed
Fix headers and include paths for NumPy 2 (currently breaks NumPy 1 build support)
1 parent 2cea9a3 commit c562b9e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

common.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,14 +506,14 @@ ifeq ($(DO_CHECKS), 1)
506506
# NUMPY is available -> next step should not fail
507507
# That's why we are not checking if the NUMPY_INCL_FLAG is defined.
508508
ifeq ($(NUMPY_CHECKED), 0)
509-
export NUMPY_INCL_FLAG := $(shell $(PYTHON) -c "from __future__ import print_function; import numpy; print('-isystem ' + numpy.__path__[0] + '/core/include/numpy/')")
509+
export NUMPY_INCL_FLAG := $(shell $(PYTHON) -c "from __future__ import print_function; import numpy; print('-isystem ' + numpy.__path__[0] + '/_core/include/')")
510510
# Take the second word -> the path (the first word is "isystem")
511511
NUMPY_INCL_PATH := $(word 2, ${NUMPY_INCL_FLAG})
512512
# Now check that the 'arrayobject.h' file is present in the
513513
# supposed numpy directory. Otherwise, compilation will fail.
514514
# The absence of the file likely indicates a missing numpy-devel
515515
# package (see issue #134 on github)
516-
NUMPY_NEEDED_HEADER_FILE := ${NUMPY_INCL_PATH}arrayobject.h
516+
NUMPY_NEEDED_HEADER_FILE := ${NUMPY_INCL_PATH}numpy/arrayobject.h
517517
ifeq (,$(wildcard ${NUMPY_NEEDED_HEADER_FILE}))
518518
$(error Required $(ccred)numpy headers$(ccreset) are missing...stopping the compilation. You might be able to fix this by installing $(ccblue)numpy-devel$(ccreset))
519519
endif

mocks/python_bindings/_countpairs_mocks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <Python.h>
1111

1212
/* Now, include the numpy header*/
13-
#include <arrayobject.h>
13+
#include <numpy/arrayobject.h>
1414

1515
//for correlation functions
1616
#include "countpairs_rp_pi_mocks.h"

theory/python_bindings/_countpairs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <stdint.h>
1616

1717
/* Now, include the numpy header*/
18-
#include <arrayobject.h>
18+
#include <numpy/arrayobject.h>
1919

2020
//for correlation functions
2121
#include "countpairs.h"

0 commit comments

Comments
 (0)