location of numpy include files  [SOLVED]

option, parallelism,...

Moderators: fgoudreault, mcote

Forum rules
Please have a look at ~abinit/doc/config/build-config.ac in the source package for detailed and up-to-date information about the configuration of Abinit 8 builds.
For a video explanation on how to build Abinit 7.x for Linux, please go to: http://www.youtube.com/watch?v=DppLQ-KQA68.
IMPORTANT: when an answer solves your problem, please check the little green V-like button on its upper-right corner to accept it.
Locked
don.fanucci
Posts: 4
Joined: Fri Nov 26, 2010 4:27 pm

location of numpy include files

Post by don.fanucci » Mon Dec 06, 2010 7:05 pm

Hi!

In many linux distributions there is a soft link to the numpy-include in the Python include directory (the latter is given by distutils.sysconfig.get_python_inc() or by the python-config command line tool).
However, this soft link does not always exist.
E.g. on our compute clusters we provide several different versions of numpy using a modules system, and to get the location of the numpy include files one could e.g. get it through numpy.get_include().

Just as an illustration, I created a simple patch witch adds both include locations to PYTHON_CPPFLAGS (I'll try to attach it to this thread)

/Mattias

don.fanucci
Posts: 4
Joined: Fri Nov 26, 2010 4:27 pm

Re: location of numpy include files

Post by don.fanucci » Mon Dec 06, 2010 7:10 pm

(Hmm, the webform says "The extension patch is not allowed.", .txt doesn't seem to work either. Nevermind, I'll put it in the message instead)
So, this is not a suggested implementation, it is just to illustrate what I mean

Code: Select all

diff --git a/configure.ac b/configure.ac
index 35deee4..468947e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -500,19 +500,21 @@ ABI_MSG_SECTION([Python support])
 
 # Look for programs
 AC_CHECK_PROGS(PYTHON,[python python2.6 python2.5 python2.4])
-AC_CHECK_PROGS(PYTHON_CONFIG,[python-config python2.6-config python2.5-config python2.4-config])
-
-# Check name consistency
-if test "${PYTHON}" != "" -a "${PYTHON_CONFIG}" != ""; then
-  if test "${PYTHON}" != "`echo ${PYTHON_CONFIG} | sed -e 's/-config//'`"; then
-    AC_MSG_WARN([Python interpeter and configurator have different names])
-  fi
-fi
 
 # Get Python preprocessing options
 AC_MSG_CHECKING([for Python CPPFLAGS])
-if test "${PYTHON_CONFIG}" != "" -a "${PYTHON_CPPFLAGS}" = ""; then
-  PYTHON_CPPFLAGS=`${PYTHON_CONFIG} --includes`
+if test "${PYTHON}" != "" -a "${PYTHON_CPPFLAGS}" = ""; then
+  PYTHON_CPPFLAGS=`${PYTHON} -c "\
+try:
+    import distutils.sysconfig
+    print '-I' + distutils.sysconfig.get_python_inc(),
+except:
+    pass
+try:
+    import numpy
+    print '-I' + numpy.get_include(),
+except:
+    pass"`
 fi
 AC_MSG_RESULT([${PYTHON_CPPFLAGS}])

mverstra
Posts: 655
Joined: Wed Aug 19, 2009 12:01 pm

Re: location of numpy include files

Post by mverstra » Sun Jan 09, 2011 1:53 pm

Hi Don,

thanks for the suggestion. I will bring it to the attention of the authorities before 6.6 is frozen (hopefully).

Cheers
Matthieu
Matthieu Verstraete
University of Liege, Belgium

gonze
Posts: 412
Joined: Fri Aug 14, 2009 8:29 pm

Re: location of numpy include files  [SOLVED]

Post by gonze » Sun Jan 09, 2011 7:31 pm

OK, included in forthcoming v6.6.0 and later !
Xavier

Locked