How to install python version lammps shlib (Python.h error)

Hello, everyone.

I’m a begginer of LAMMPS.
I want to install SPINNER in github.
(GitHub - MDIL-SNU/SPINNER: SPINNER (Structure Prediction of Inorganic crystals using Neural Network potentials with Evolutionary and Random searches))

For installing SPINNER, I shoud install python lammps with shared lib version.
They said that I can install python-lammps by following steps below

But, I have some error in
“make XXX mode=shlib” line.

I want to install serial mode lammps , so I command that “make serial mode=shlib”
I already checked Mafile.serial in src/MAKE directory.

But, I have a message like below that such as Python.h error…

I confused that the shlib and python-lammps version install…
I’m installing lammps with linux virtual environment status and I can’t access root account (cannot use sudo, yum command…)

How can I solve this error…?

Thanks a lot.
Jihoon Kim

Technically speaking, you should contact the “SPINNER” developers for help, since they require that you use their modified version of LAMMPS included in their distribution.

My guess is, that they don’t really understand what is required to enable building LAMMPS for use with the LAMMPS python module, since they suggest to use “make yes-python” which is not required for this purpose, but rather required to call python from LAMMPS, i.e. the other way around. To use the PYTHON package (which is what “make yes-python”) enables, you need to embed a Python interpreter into LAMMPS and for that you need to have the python development package installed, which is obviously not the case. You can check for this with running the command python-config --libs --embed which should return something like “-lpython3.11 -ldl -lm” and not “bash: python-config: command not found”.

So you either have to install the python development package, or use “make no-python” to avoid embedding the python interpreter. The compilation should proceed and then you should be able to use make install-python.

If my guesses are incorrect, then you have to really consult with the SPINNER package developers, however, it looks like that project has been idle for the last 2 years, so you may need a bit of luck there. This also means you have to use a LAMMPS version from 2020 and this is a bit of a pity, since we have made quite some improvements since then to both, the code and the build process.

Oh, thanks a lot!
The lammps serial version installation is good now!!!.

But, I have some different message in next step. “make install-python”

After “make serial mode=shlib” command,
“make install-python” command makes error message below that.


How can I solve this error??!

Regards.
Jihoon Kim

I see no errors, only (serious) warnings.

There is not much you can do about it. In 2020, the method used by install-python was still acceptable, now it is not. We have addressed this in more recent LAMMPS versions.