I have compiled and built lammps/liggghts via the setup.py and installed openmpi with shared libraries. When I go to a python console (or execute one of the included demos), this is the output:
from lammps import lammps
lmp = lammps()
Traceback (most recent call last):
File “”, line 1, in
File “lammps.py”, line 37, in init
raise OSError,“Could not load LAMMPS dynamic library”
OSError: Could not load LAMMPS dynamic library
The 3 required files ARE in /usr/local/lib/python2.7/dist-packages (lammps.py, lammps.pyc, _lammps.so).
What is the problem?
I have compiled and built lammps/liggghts via the setup.py and installed
if you are building LIGGGHTS, you should ask in the LIGGGHTS forum for help.
Ctypes can have various problems loading your lib, which manifest
in that single error message.
If you have done this before and know what you are doing, then
the problem could be that you are building the LAMMPS lib with
various packages and extra dependencies (e.g. whatever LIGGGHTS
needs, like an OpenFoam lib). If those libs are not *.so and not
find-able by the loader, I think you will get that error.
If you’ve never done this before, I suggest you build a minimal
LAMMPS (and w/out LIGGGHTS) and try to get it to load
as a first step. And rather than put the files under dist-packages,
follow the simpler steps in python/README using an ENV variable
or two in your shell, and don’t even move the files around.
If that works, build back up to your full example and see
where the problem is.