diff --git a/lib/python/Makefile.lammps b/lib/python/Makefile.lammps index e4afa70456..bfde590a39 100644 --- a/lib/python/Makefile.lammps +++ b/lib/python/Makefile.lammps @@ -1,7 +1,14 @@ # Settings that the LAMMPS build will import when this package library is used # See the README file for more explanation - -python_SYSINC = $(shell which python-config > /dev/null 2>&1 && python-config --includes || :) -python_SYSLIB = $(shell which python-config > /dev/null 2>&1 && python-config --ldflags --embed > /dev/null 2>&1 && python-config --ldflags --embed || (which python-config > /dev/null 2>&1 && python-config --ldflags || :) ) -python_SYSPATH = +ifeq ($(shell type python3 >/dev/null 2>&1; echo $$?), 0) +PYTHON=python3 +PYTHONCONFIG = python3-config +else +PYTHONCONFIG = python-config PYTHON=python +endif + + +python_SYSINC = $(shell which $(PYTHONCONFIG) > /dev/null 2>&1 && $(PYTHONCONFIG) --includes || :) +python_SYSLIB = $(shell which $(PYTHONCONFIG) > /dev/null 2>&1 && $(PYTHONCONFIG) --ldflags --embed > /dev/null 2>&1 && $(PYTHONCONFIG) --ldflags --embed || (which $(PYTHONCONFIG) > /dev/null 2>&1 && $(PYTHONCONFIG) --ldflags || :) ) +python_SYSPATH = diff --git a/tools/singularity/ubuntu20.04.def b/tools/singularity/ubuntu20.04.def index d62b4c9f86..91efd1b5fd 100644 --- a/tools/singularity/ubuntu20.04.def +++ b/tools/singularity/ubuntu20.04.def @@ -54,6 +54,7 @@ From: ubuntu:20.04 python3-setuptools \ python3-virtualenv \ python3-venv \ + python-is-python3 \ rsync \ ssh \ texlive \ diff --git a/tools/singularity/ubuntu20.04_amd_rocm.def b/tools/singularity/ubuntu20.04_amd_rocm.def index 6792322af0..28f35ef406 100644 --- a/tools/singularity/ubuntu20.04_amd_rocm.def +++ b/tools/singularity/ubuntu20.04_amd_rocm.def @@ -83,6 +83,7 @@ From: ubuntu:20.04 python3-setuptools \ python3-virtualenv \ python3-venv \ + python-is-python3 \ rsync \ ssh \ vim-nox \ diff --git a/tools/singularity/ubuntu20.04_gpu.def b/tools/singularity/ubuntu20.04_gpu.def index b746f92086..0044970b04 100644 --- a/tools/singularity/ubuntu20.04_gpu.def +++ b/tools/singularity/ubuntu20.04_gpu.def @@ -88,6 +88,7 @@ From: ubuntu:20.04 python3-setuptools \ python3-virtualenv \ python3-venv \ + python-is-python3 \ rsync \ ssh \ vim-nox \ diff --git a/tools/singularity/ubuntu20.04_intel_opencl.def b/tools/singularity/ubuntu20.04_intel_opencl.def index c8680a16c7..42cc1ab6fa 100644 --- a/tools/singularity/ubuntu20.04_intel_opencl.def +++ b/tools/singularity/ubuntu20.04_intel_opencl.def @@ -53,6 +53,7 @@ From: ubuntu:20.04 python3-setuptools \ python3-virtualenv \ python3-venv \ + python-is-python3 \ rsync \ ssh \ vim-nox \ diff --git a/tools/singularity/ubuntu20.04_nvidia.def b/tools/singularity/ubuntu20.04_nvidia.def index 3affc30b8b..aacaeec7b5 100644 --- a/tools/singularity/ubuntu20.04_nvidia.def +++ b/tools/singularity/ubuntu20.04_nvidia.def @@ -56,6 +56,7 @@ From: nvidia/cuda:11.6.2-devel-ubuntu20.04 python3-setuptools \ python3-virtualenv \ python3-venv \ + python-is-python3 \ rsync \ ssh \ vim-nox \ diff --git a/tools/singularity/ubuntu20.04_oneapi.def b/tools/singularity/ubuntu20.04_oneapi.def index 70d69c7d80..36677ec867 100644 --- a/tools/singularity/ubuntu20.04_oneapi.def +++ b/tools/singularity/ubuntu20.04_oneapi.def @@ -52,6 +52,7 @@ From: ubuntu:20.04 python3-setuptools \ python3-virtualenv \ python3-venv \ + python-is-python3 \ rsync \ ssh \ texlive \ diff --git a/tools/singularity/ubuntu22.04.def b/tools/singularity/ubuntu22.04.def index ef43347982..e14d448ce8 100644 --- a/tools/singularity/ubuntu22.04.def +++ b/tools/singularity/ubuntu22.04.def @@ -54,6 +54,7 @@ From: ubuntu:22.04 python3-setuptools \ python3-virtualenv \ python3-venv \ + python-is-python3 \ rsync \ ssh \ texlive \