Could not find Python function (src/PYTHON/fix_python_invoke.cpp:69)

Hi, I am a graduate student trying to simulate some ion cloud dynamics. I previously used LAMMPS without Python back in 2020. Recently, I installed LAMMPS on Windows with the 2 August 2023 stable version with Python. When I tried to run the same code (but using the PyLammps wrapper), I get the error Exception: ERROR: Could not find Python function (src/PYTHON/fix_python_invoke.cpp:69).

I tried doing the same thing on a different computer, and with a different version (e.g. 15 June 2023), but I get the same error. I must have missed something during the installation, but it was not obvious to me from the documentation.

On a (maybe) related note, when I installed with a stable version without Python, PyLammps runs fine, but it spits out a warning WARNING: run thermo data not captured since PYTHON LAMMPS package is not enabled.

Please help, thank you!

This is a question for @rberger, the author of PyLammps.
I suspect you need to use the python that is bundled with LAMMPS, but you are using a different one.

For serious work I recommend to not use PyLammps but rather the regular lammps python module.
For that you don’t need the PYTHON package and an embedded Python interpreter, it also is by far less fragile and better performing.

1 Like

Thank you!

Using lammps instead of PyLammps works fine; I just used the <lammps>.command_string() method to run my lammps script that I would usually run with lmp -in. I am still using my own python (not bundled with LAMMPS) though.