evaleev / libint

Libint: high-performance library for computing Gaussian integrals in quantum mechanics
Other
218 stars 96 forks source link

make fails if `python` is not found #320

Closed hejamu closed 5 months ago

hejamu commented 5 months ago

Building libint fails if python is not a defined command (as is standard on Ubuntu). I stumbled across this in the cp2k toolchain.

==================== Installing LIBINT ====================
wget  --quiet https://www.cp2k.org/static/downloads/libint-v2.6.0-cp2k-lmax-5.tgz
libint-v2.6.0-cp2k-lmax-5.tgz: OK
Checksum of libint-v2.6.0-cp2k-lmax-5.tgz Ok
Installing from scratch into /tmp/cp2k/tools/toolchain/install/libint-v2.6.0-cp2k-lmax-5

/usr/bin/install -c -d -m 0755 /tmp/cp2k/tools/toolchain/install/libint-v2.6.0-cp2k-lmax-5/include/libint2
...[blablabla]...
/tmp/cp2k/tools/toolchain/install/gcc-13.2.0/bin/g++ -O2 -fPIC -fno-omit-frame-pointer -fopenmp -g -march=native -mtune=native -g1 -E -DHAVE_CONFIG_H -D__COMPILING_LIBINT2=1 -D__COMPILING_LIBINT2=1 -I../include -I..//include -I/usr/include -O2 -fPIC -fno-omit-frame-pointer -fopenmp -g -march=native -mtune=native -O2 -fPIC -fno-omit-frame-pointer -fopenmp -g -march=native -mtune=native -g1  ../include/libint2.h > ../include/libint2.h.i
python c_to_f.py ../include/libint2.h.i libint2_types_f.h Libint_t
pyenv: python: command not found

The `python' command exists in these Python versions:
  3.11.3

Note: See 'pyenv help global' for tips on allowing both
      python2 and python3 to be found.
make[1]: *** [Makefile:27: libint2_types_f.h] Error 127
make[1]: Leaving directory '/tmp/cp2k/tools/toolchain/build/libint-v2.6.0-cp2k-lmax-5/fortran'
make: *** [Makefile:38: fortran] Error 1
Step libint took 564.00 seconds.

Changing the command to python3 would fix this inconvenience of needing to define the python command.

loriab commented 5 months ago

I don't know if it's any help, but I notice libint v2.6 is using the old find_package(PythonInterp) detection. It's whatever cmake detects for the Python cmd that gets substituted in at https://github.com/evaleev/libint/blob/v2.6.0/export/cmake/CMakeLists.txt.export#L308 line that you're hitting. Newer v2.8 libint uses find_package(Python) . (This shows up as ${PYTHON_EXECUTABLE} (old) vs. ${Python_EXECUTABLE} (new) at https://github.com/evaleev/libint/blob/master/export/cmake/CMakeLists.txt.export#L512 ). I hope the newer detection can find python3 if python doesn't exist, as your situation seems widespread.

evaleev commented 5 months ago

I agree with @loriab mentioned, python detection has been updated to the latest CMake module. Please upgrade to 2.8.1, this problem should not occur.

evaleev commented 5 months ago

fixed via https://github.com/evaleev/libint/pull/268