Bug #3329

Is gammalib 1.7.0 compatible with python 3.8?

Added by Rodriguez Fernandez Gonzalo over 3 years ago. Updated over 3 years ago.

Status:ClosedStart date:09/03/2020
Priority:UrgentDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:1.7.1
Duration:

Description

I am trying to install gammalib 1.7.0 on my ubuntu 20.04 with python_dev 3.8

from the configuration command I have this output:

checking for a Python interpreter with version >= 2.3... python
checking for python... /usr/bin/python
checking for python version... 3.8
checking for python platform... linux
checking for python script directory... ${prefix}/lib/python3.8/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python3.8/site-packages
checking for the distutils Python package... yes
checking /usr/include/python3.8/Python.h usability... no
checking /usr/include/python3.8/Python.h presence... no
checking for /usr/include/python3.8/Python.h... no
checking for swig... /usr/bin/swig

GammaLib configuration summary ============================== * FITS I/O support (yes) * Readline support (yes) * Ncurses support (yes) * End user configuration (yes)
- Make Python binding (no) Python.h not installed * Python (yes)
- Python.h (no) * Python wrappers (yes) * swig (yes) * Multiwavelength interface (yes) * Fermi-LAT interface (yes) * CTA interface (yes) * COMPTEL interface (yes) * SPI interface (yes) * Doxygen (yes) /usr/bin/doxygen * Perform NaN/Inf checks (yes) (default) * Perform range checking (yes) (default) * Optimize memory usage (yes) (default) * Support legacy XML format (yes) (default) * Enable OpenMP (yes) (default)
- Compile in debug code (no) (default)
- Enable code for profiling (no) (default)

Python.h exist in /usr/include/python3.8/Python.h but for some reason i will no be used.
Do I need to downgrade python?

Gonzalo.


Recurrence

No recurrence.

History

#1 Updated by Knödlseder Jürgen over 3 years ago

  • Assigned To set to Knödlseder Jürgen
  • Priority changed from Normal to Urgent

I have so far not tested GammaLib on Python 3.8. I will check as soon as possible and let you know my findings. For sure, GammaLib and ctools works with Python 3.7.

#2 Updated by Knödlseder Jürgen over 3 years ago

Just as an additional comment: at the step where you have problems, I think the code just checks whether the header files actually exist. Have you checked that you can actually read the file

/usr/include/python3.8/Python.h

#3 Updated by Knödlseder Jürgen over 3 years ago

  • Tracker changed from Support to Bug
  • Target version set to 1.7.1
  • % Done changed from 0 to 10

I was able to reproduce your problem. So for the time being you have to downgrade your Python version to 3.7, sorry for that.

Here is the error that occurs in config.log (I suppose you seem something similar):

configure:16410: checking /home/jenkins/python/python385/include/python3.8/Python.h usability
configure:16410: g++ -c -g -O2 -fopenmp  -I/home/jenkins/cfitsio/cfitsio3310/include -I/home/jenkins/ncurses/ncurses59/include/ncurses -I/home/jenkins/readline/readline62/include conftest.cpp >&5
In file included from /home/jenkins/python/python385/include/python3.8/pystate.h:129:0,
                 from /home/jenkins/python/python385/include/python3.8/genobject.h:11,
                 from /home/jenkins/python/python385/include/python3.8/Python.h:121,
                 from conftest.cpp:63:
/home/jenkins/python/python385/include/python3.8/cpython/pystate.h:9:32: fatal error: cpython/initconfig.h: No such file or directory
 #include "cpython/initconfig.h" 
                                ^
compilation terminated.
configure:16410: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "gammalib" 
| #define PACKAGE_TARNAME "gammalib" 
| #define PACKAGE_VERSION "1.8.0.dev" 
| #define PACKAGE_STRING "gammalib 1.8.0.dev" 
| #define PACKAGE_BUGREPORT "jurgen.knodlseder@irap.omp.eu" 
| #define PACKAGE_URL "" 
| #define PACKAGE "gammalib" 
| #define VERSION "1.8.0.dev" 
| #define PACKAGE_PREFIX "/home/jenkins/jenkins/install/python/python385/gammalib" 
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/" 
| #define G_NAN_CHECK 1
| #define G_RANGE_CHECK 1
| #define G_SMALL_MEMORY 1
| #define G_LEGACY_XML_FORMAT 1
| #define G_WARNINGS 1
| #define HAVE_OPENMP 1
| /* end confdefs.h.  */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| #  include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| #  include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| #include </home/jenkins/python/python385/include/python3.8/Python.h>
configure:16410: result: no
configure:16410: checking /home/jenkins/python/python385/include/python3.8/Python.h presence
configure:16410: g++ -E  -I/home/jenkins/cfitsio/cfitsio3310/include -I/home/jenkins/ncurses/ncurses59/include/ncurses -I/home/jenkins/readline/readline62/include conftest.cpp
In file included from /home/jenkins/python/python385/include/python3.8/pystate.h:129:0,
                 from /home/jenkins/python/python385/include/python3.8/genobject.h:11,
                 from /home/jenkins/python/python385/include/python3.8/Python.h:121,
                 from conftest.cpp:30:
/home/jenkins/python/python385/include/python3.8/cpython/pystate.h:9:32: fatal error: cpython/initconfig.h: No such file or directory
 #include "cpython/initconfig.h" 
                                ^
compilation terminated.
configure:16410: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "gammalib" 
| #define PACKAGE_TARNAME "gammalib" 
| #define PACKAGE_VERSION "1.8.0.dev" 
| #define PACKAGE_STRING "gammalib 1.8.0.dev" 
| #define PACKAGE_BUGREPORT "jurgen.knodlseder@irap.omp.eu" 
| #define PACKAGE_URL "" 
| #define PACKAGE "gammalib" 
| #define VERSION "1.8.0.dev" 
| #define PACKAGE_PREFIX "/home/jenkins/jenkins/install/python/python385/gammalib" 
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/" 
| #define G_NAN_CHECK 1
| #define G_RANGE_CHECK 1
| #define G_SMALL_MEMORY 1
| #define G_LEGACY_XML_FORMAT 1
| #define G_WARNINGS 1
| #define HAVE_OPENMP 1
| /* end confdefs.h.  */
| #include </home/jenkins/python/python385/include/python3.8/Python.h>
configure:16410: result: no
configure:16410: checking for /home/jenkins/python/python385/include/python3.8/Python.h
configure:16410: result: no
Here the issue is that #include "cpython/initconfig.h" is not found.

I will investigate the issue.

#4 Updated by Knödlseder Jürgen over 3 years ago

  • % Done changed from 10 to 20
Apparently, others also stumbled over this issue:

This looks like a Python bug. I see if I can implement a fix for it.

#5 Updated by Knödlseder Jürgen over 3 years ago

Adding the Python include path to configure.ac as follows

echo "*** CHECK FOR Python.h ***" 
CPPFLAGS="$CPPFLAGS -I$python_path"  <== ADDED
AC_CHECK_HEADERS($python_path/Python.h, [has_python_h="yes"], [has_python_h="no"])
echo "*** CHECK DONE ***" 
solved the issue:
*** CHECK FOR Python.h ***
checking /home/jenkins/python/python385/include/python3.8/Python.h usability... yes
checking /home/jenkins/python/python385/include/python3.8/Python.h presence... yes
checking for /home/jenkins/python/python385/include/python3.8/Python.h... yes
*** CHECK    DONE ***

#6 Updated by Knödlseder Jürgen over 3 years ago

  • Status changed from New to Feedback
  • % Done changed from 20 to 100

I implemented the fix in the bugfix-1.7.1 branch. First tests are okay.

Rodriguez, can you try on your side if the change fixes your problems? If yes I will include the fix in the next 1.7.1 release. To make the check:

$ git clone https://cta-gitlab.irap.omp.eu/gammalib/gammalib.git
$ cd gammalib
$ git checkout bugfix-1.7.1
$ ./autogen.sh
$ ./configure
and verify that the Python header files are found. By the way: I did the same fix on the ctools side. Change is also in the bugfix-1.7.1 branch.

#7 Updated by Rodriguez Fernandez Gonzalo over 3 years ago

Yes, now it is working!

Thanks!
Gonzalo

#8 Updated by Rodriguez Fernandez Gonzalo over 3 years ago

by the way,
the same must be done with CTOOLS

#9 Updated by Knödlseder Jürgen over 3 years ago

Rodriguez Fernandez Gonzalo wrote:

by the way,
the same must be done with CTOOLS

It’s already done for ctools. Can you please check using

$ git clone https://cta-gitlab.irap.omp.eu/ctools/ctools.git
$ cd ctools
$ git checkout bugfix-1.7.1
$ ./autogen.sh
$ ./configure

#10 Updated by Rodriguez Fernandez Gonzalo over 3 years ago

yes, it is also working for CTOOLS!

Gonzalo.

#11 Updated by Knödlseder Jürgen over 3 years ago

  • Status changed from Feedback to Closed

Thanks, I close the issue now.

Also available in: Atom PDF