SheffieldML / GPy

Gaussian processes framework in python
BSD 3-Clause "New" or "Revised" License
2.03k stars 560 forks source link

Error on install_longintrepr.h #998

Open manueldeprada opened 1 year ago

manueldeprada commented 1 year ago

I came across this error while trying to install on Python 3.11 or Python 3.10:

gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/prada/.local/lib/python3.11/site-packages/numpy/core/include -I. -I/usr/include/python3.11 -c GPy/kern/src/stationary_cython.c -o build/temp.linux-x86_64-cpython-311/GPy/kern/src/stationary_cython.o -fopenmp -O3
      GPy/kern/src/stationary_cython.c:196:12: error fatal: longintrepr.h: File does not exist
        196 |   #include "longintrepr.h"
            |            ^~~~~~~~~~~~~~~

Solution I found: download sources from git, link like ln -s /usr/include/python3.10/cpython/longintrepr.h longintrepr.h and build GPy.

It still doesn't build in Python 3.11 due API changes like this one:

GPy/kern/src/stationary_cython.c:318:11: error: no enough arguments for function ‘PyCode_New’
  318 |           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
      |           ^~~~~~~~~~

but soft-linking longintrepr.h allows successful building with Python 3.10.

casellimarco commented 1 year ago

Installing python3.10-dev solves it, I haven't tried it on 3.11

muxator commented 1 year ago

Same error here: Fedora 37, python 3.11.1, tried to install GPy 1.10.0 via pip.

Apparently there are no binary wheels available for python 3.11 (and 3.100, too). Pip then tries to locally build GPy, and there is this failure (which is due to changes in CPython):

gcc [...] -c GPy/kern/src/stationary_cython.c -o [...]/stationary_cython.o [...]
GPy/kern/src/stationary_cython.c:196:12: fatal error: longintrepr.h: No such file or directory
    196 |   #include "longintrepr.h"
        |            ^~~~~~~~~~~~~~~
compilation terminated.
bpkroth commented 1 year ago

(hasty notes) Looking at this for a conda environment too. There the .h file is in the conda env, but the path to find it is missing. It only looks in include/python3.11 instead of include/python3.11/cython which is where the .h file is.

jeremysanders commented 1 year ago

The real fix is for someone to run cython on each of the .pyx files in the repository, and replacing the generated .c files in the repository.

muxator commented 1 year ago

Hi, are there any plans to support python 3.11? This is going to be a progressively bigger issue as times goes by. Is some help needed?

muxator commented 1 year ago

Note for whoever is following this issue: the closer fix seems to be this PR: #1020.