[lammps-users] LAMMPS python full installation error

Dear Developers and Users!
I want to install full LAMMPS so that I can run from python. I have macbook pro (Big Sur). Here is error i got:

ramchand@Rams-MacBook-Pro build % cmake -C cmake/presets/minimal.cmake -D BUILD_SHARED_LIBS=on \

-D LAMMPS_EXCEPTIONS=on -D PKG_PYTHON=on …/cmake

loading initial cache file cmake/presets/minimal.cmake

CMake Error: Error processing file: /Users/ramchand/mylammps/build/cmake/presets/minimal.cmake

– The CXX compiler identification is AppleClang 12.0.0.12000032

– Detecting CXX compiler ABI info

– Detecting CXX compiler ABI info - done

– Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped

– Detecting CXX compile features

– Detecting CXX compile features - done

– Found Git: /usr/bin/git (found version “2.24.3 (Apple Git-128)”)

– Running check for auto-generated files from make-based build system

– Found MPI_CXX: /usr/local/Cellar/open-mpi/4.0.5/lib/libmpi.dylib (found version “3.1”)

– Found MPI: TRUE (found version “3.1”)

– Found JPEG: /opt/local/lib/libjpeg.dylib (found version “90”)

– Found PNG: /opt/local/lib/libpng.dylib (found version “1.6.37”)

– Found ZLIB: /opt/local/lib/libz.dylib (found version “1.2.11”)

– Found GZIP: /usr/bin/gzip

– Could NOT find FFMPEG (missing: FFMPEG_EXECUTABLE)

– Found Python: /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 (found version “3.8.7”) found components: Development Development.Module Development.Embed

– Looking for C++ include cmath

– Looking for C++ include cmath - found

– Generating style headers…

– Generating package headers…

– Generating lmpinstalledpkgs.h…

– Found Python: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/bin/python3.8 (found version “3.8.2”) found components: Interpreter

– The following tools and libraries have been found and configured:

  • Git

  • MPI

  • JPEG

  • PNG

  • ZLIB

  • Python

– <<< Build configuration >>>

Operating System: Darwin

Build type: RelWithDebInfo

Install path: /Users/ramchand/.local

Generator: Unix Makefiles using /usr/local/bin/gmake

– Enabled packages: PYTHON

– <<< Compilers and Flags: >>>

– C++ Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++

Type: AppleClang

Version: 12.0.0.12000032

C++ Flags: -O2 -g -DNDEBUG

Defines: LAMMPS_SMALLBIG;LAMMPS_MEMALIGN=64;LAMMPS_EXCEPTIONS;LAMMPS_JPEG;LAMMPS_PNG;LAMMPS_GZIP;LMP_PYTHON

– <<< Linker flags: >>>

– Executable name: lmp

– Shared library flags:

– <<< MPI flags >>>

– MPI_defines:

– MPI includes: /usr/local/Cellar/open-mpi/4.0.5/include

– MPI libraries: /usr/local/Cellar/open-mpi/4.0.5/lib/libmpi.dylib;

– Configuring incomplete, errors occurred!

See also “/Users/ramchand/mylammps/build/CMakeFiles/CMakeOutput.log”.

See also “/Users/ramchand/mylammps/build/CMakeFiles/CMakeError.log”.

ramchand@Rams-MacBook-Pro build %

Please help me! Thank you very much!

Dear Developers and Users!
I want to install full LAMMPS so that I can run from python. I have macbook pro (Big Sur). Here is error i got:

ramchand@Rams-MacBook-Pro build % cmake -C cmake/presets/minimal.cmake -D BUILD_SHARED_LIBS=on \

-D LAMMPS_EXCEPTIONS=on -D PKG_PYTHON=on …/cmake

loading initial cache file cmake/presets/minimal.cmake

CMake Error: Error processing file: /Users/ramchand/mylammps/build/cmake/presets/minimal.cmake

here is the relevant error message. clearly, your cmake command line is not correctly referring to the preset file you want to use. it is most certainly not in the build folder.

axel.

Dear Axel Kohlmeyer!
Thank yo very much for help. I installed the code but it is not running with any version of python. However it shows correct path of instllation directory and I have also exported the path. See here (it is not working with python 3.7 or 3.8):

ramchand@Rams-MacBook-Pro ~ % export DYLD_LIBRARY_PATH=/Users/ramchand/.local/lib/:$DYLD_LIBRARY_PATH

ramchand@Rams-MacBook-Pro ~ % python3.7

Python 3.7.9 (default, Nov 15 2020, 00:39:33)

[Clang 12.0.0 (clang-1200.0.32.27)] on darwin

Type “help”, “copyright”, “credits” or “license” for more information.

import lammps

Traceback (most recent call last):

File “”, line 1, in

ramchand@Rams-MacBook-Pro ~ % ls /Users/ramchand/.local/lib/python3.8/site-packages/lammps/

init.py pycache/ constants.pyc core.pyc data.pyc pylammps.py

init.pyc constants.py core.py data.py numpy.py pylammps.pyc

And with python2.7

ramchand@Rams-MacBook-Pro lammps % python

WARNING: Python 2.7 is not recommended.

This version is included in macOS for compatibility with legacy software.

Future versions of macOS will not include Python 2.7.

Instead, it is recommended that you transition to using ‘python3’ from within Terminal.

Python 2.7.16 (default, Nov 23 2020, 08:01:20)

[GCC Apple LLVM 12.0.0 (clang-1200.0.30.4) [+internal-os, ptrauth-isa=sign+stri on darwin

Type “help”, “copyright”, “credits” or “license” for more information.

import lammps

Traceback (most recent call last):

File “”, line 1, in

ImportError: No module named lammps

Here LAMMPS and python version:

ramchand@Rams-MacBook-Pro lammps % lmp_serial

LAMMPS (29 Oct 2020)

^Z

zsh: suspended lmp_serial

ramchand@Rams-MacBook-Pro lammps % which python

/usr/bin/python

ramchand@Rams-MacBook-Pro lammps % port select --list python

Warning: port definitions are more than two weeks old, consider updating them by running ‘port selfupdate’.

Available versions for python:

none

python27-apple

python37 (active)

python38

python38-apple

ramchand@Rams-MacBook-Pro lammps %

Best regards,

Ram Chand,

you are providing inconsistent and incomplete information.

what version of LAMMPS are you trying to install?
it cannot be version 29Oct2020, since the files you show in the python site-packages folder can only be created by a newer version of LAMMPS.

how did you “install” LAMMPS and the LAMMPS Python package?

since you are using a mac, there may be a problem with the way how the CMake “install” handles this.
by default you should not need to set any environment variables when you do a python package installation.
As you can see from the python docs, https://docs.python.org/3/library/site.html#site.USER_SITE the default location depends on the kind of python you have installed.

you should first delete all existing LAMMPS related files in the various local “site-packages” folders. from what I can see, you have created a mighty mess of things and you need a clean start. you should also delete all legacy LAMMPS executables and shared libraries in folders that are in your PATH or DYLD_LIBRARY_PATH.

then i suggest you start a new login session, go to your build folder and do: make install-python
and then try to load the lammps python module without setting any environment variables.
you may still later do a ‘cmake --install .’ later to install the executable (which will be called “lmp” not “lmp_serial”).

Dear Axel Kohlmeyer!
Thank yo very much for help. I installed the code but it is not running with any version of python. However it shows correct path of instllation directory and I have also exported the path. See here (it is not working with python 3.7 or 3.8):

ramchand@Rams-MacBook-Pro ~ % export DYLD_LIBRARY_PATH=/Users/ramchand/.local/lib/:$DYLD_LIBRARY_PATH

ramchand@Rams-MacBook-Pro ~ % python3.7

Python 3.7.9 (default, Nov 15 2020, 00:39:33)

[Clang 12.0.0 (clang-1200.0.32.27)] on darwin

Type “help”, “copyright”, “credits” or “license” for more information.

import lammps

Traceback (most recent call last):

File “”, line 1, in

ramchand@Rams-MacBook-Pro ~ % ls /Users/ramchand/.local/lib/python3.8/site-packages/lammps/

init.py pycache/ constants.pyc core.pyc data.pyc pylammps.py

init.pyc constants.py core.py data.py numpy.py pylammps.pyc

this is inconsistent with the python version and also shows that you have incorrectly set the PYTHONPATH variable to this folder and then used a python 2.x version.

And with python2.7

we should all stop using python 2.x

axel.