I have compiled my own python installation with additional libraries for m3gnet to be used with LAMMPS. When I run cmake and specify to use my own python build, it is ignored and instead uses the system python. As a general rule, I keep my compiled code separate from OS provided packages for security and sanity.
Script/commands I use to run cmake
cd /data/tools/download/lammps/build cmake ../lammps/cmake \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=yes \ -DCMAKE_INSTALL_PREFIX:PATH=/data/tools/ubuntu_22.04/lammps/2jun2022/ \ -DPKG_PYTHON:BOOL=yes \ -DPYTHON_EXECUTABLE:FILEPATH=/data/tools/ubuntu_22.04/python/3.11.2/bin/python3 \ | tee cmake.log
After running previous command/script, I get the CMake Warning:
CMake Warning: Manually-specified variables were not used by the project: PYTHON_EXECUTABLE
While digging through the CMakeCache.txt for python references, the following show up:
//Build PYTHON Package PKG_PYTHON:BOOL=yes //No help, variable specified on the command line. PYTHON_EXECUTABLE:FILEPATH=/data/tools/ubuntu_22.04/python/3.11.2/bin/python3 //Dependencies for the target lammps_LIB_DEPENDS:STATIC=general;JPEG::JPEG;general;PNG::PNG;general;ZLIB::ZLIB;general;Python::Python;general;/usr/lib/x86_64-linux-gnu/libm.so;general;dl; //Details about finding Python FIND_PACKAGE_MESSAGE_DETAILS_Python:INTERNAL=[/usr/bin/python3.10][cfound components: Interpreter ][v3.10.6()] //Path to a program. _Python3_EXECUTABLE:INTERNAL=/usr/bin/python3.10 //Python3 Properties _Python3_INTERPRETER_PROPERTIES:INTERNAL=Python;3;10;6;64;;cpython-310-x86_64-linux-gnu;/usr/lib/python3.10;/usr/lib/python3.10;/usr/lib/python3/dist-packages;/usr/lib/python3/dist-packages _Python3_INTERPRETER_SIGNATURE:INTERNAL=b91b4035ecb3bb3f5760d35922531bcd _Python_DEVELOPMENT_EMBED_SIGNATURE:INTERNAL=625d9e0f7a1af1ddb80bfa11fbea90e0 _Python_DEVELOPMENT_MODULE_SIGNATURE:INTERNAL=4bc14a0ea6a21ea267e38aa660e9b54b _Python_EXECUTABLE:INTERNAL=/usr/bin/python3.10 //Path to a file. _Python_INCLUDE_DIR:INTERNAL=/usr/include/python3.10 //Python Properties _Python_INTERPRETER_PROPERTIES:INTERNAL=Python;3;10;6;64;;cpython-310-x86_64-linux-gnu;/usr/lib/python3.10;/usr/lib/python3.10;/usr/lib/python3/dist-packages;/usr/lib/python3/dist-packages _Python_INTERPRETER_SIGNATURE:INTERNAL=b91b4035ecb3bb3f5760d35922531bcd //Path to a library. _Python_LIBRARY_RELEASE:INTERNAL=/usr/lib/x86_64-linux-gnu/libpython3.10.so
The only significant clue I have is that CMake finds a libpython3.10.so where my installation does not have an .so file... only .a files.
$ find /data/tools/ubuntu_22.04/python/3.11.2 -name "libpython3*" /data/tools/ubuntu_22.04/python/3.11.2/lib/python3.11/config-3.11-x86_64-linux-gnu/libpython3.11.a /data/tools/ubuntu_22.04/python/3.11.2/lib/libpython3.11.a
I have dug through the documentation. I'm at a loss. Any insights or suggestions on something I missed in the build documentation is appreciated.