I’m trying to compile lammps with python support on a system that has python 3.14. It’s failing with a cython error, namely a failed import of distutils.extension (see [BUG] distutils used in cythonize (fails in 3.12) · Issue #5751 · cython/cython · GitHub ). This seems to be an upstream cython problem, not a LAMMPS problem, so I didn’t open a lammps issue, but posted here in hopes that anyone has run into this and has a better workaround than patching that cython function to import from setuptools.extension instead
Hmmm… I cannot confirm this. I just compiled LAMMPS with python support and mliappy etc. on a Fedora 44 machine (which ships with Python 3.14) and there was no failure, just some verbose warnings about the GIL.
Odd. Would you mind sharing a pip list and the cmake command line, so I can try to figure out what I’m doing differently?
Cython is installed via rpm.
$ rpm -qi python3-cython
Name : python3-cython
Version : 3.2.4
Release : 3.fc44
Architecture: x86_64
Install Date: Mon 13 Apr 2026 11:16:38 AM EDT
Group : Unspecified
Size : 20150066
License : Apache-2.0
Signature :
RSA/SHA256, Mon 19 Jan 2026 10:13:58 PM EST, Key ID dbfcf71c6d9f90a6
Source RPM : Cython-3.2.4-3.fc44.src.rpm
Build Date : Fri 16 Jan 2026 01:30:34 AM EST
Build Host : buildvm-x86-30.rdu3.fedoraproject.org
Packager : Fedora Project
Vendor : Fedora Project
URL : http://www.cython.org
Bug URL : https://bugz.fedoraproject.org/Cython
Summary : Language for writing Python extension modules
I cannot provide the exact command line, since this is my regular development build where keep turning things on and off with ccmake and occasionally edit settings etc. The best I can do is the output of ./lmp -h.
Large-scale Atomic/Molecular Massively Parallel Simulator - 30 Sep 2026 - Development
Git info (develop / patch_30Sep2026-820-g7dbed49448)
OS: Linux "Fedora Linux 44 (Forty Four)" 7.2.11-200.fc44.x86_64 x86_64
Compiler: GNU C++ 16.2.1 20261029 (Red Hat 16.2.1-3) with OpenMP 5.2
C++ standard: C++20
Using fmt library emulation with std::format
Embedded JSON class version: 3.12.0
MPI v4.1: MPICH Version: 4.2.2
MPICH Release date: Wed Jul 3 09:16:22 AM CDT 2024
MPICH ABI: 16:2:4
Accelerator configuration:
GPU package API: OpenCL
GPU package precision: mixed
KOKKOS package API: OpenMP Serial
KOKKOS package precision: double
KOKKOS package random numbers: device
KOKKOS package view layout: legacy
Kokkos library version: 5.2.1
OPENMP package API: OpenMP
OPENMP package precision: double
OpenMP standard: OpenMP 5.2
INTEL package API: OpenMP
INTEL package precision: single mixed double
INTEL package SIMD: not enabled
Compatible GPU present: no
FFT information:
FFT precision = double
FFT engine = mpiFFT
FFT library = FFTW3 with threads
KOKKOS FFT engine = mpiFFT
KOKKOS FFT library = FFTW3 with threads
Active compile time flags:
-DLAMMPS_PNG
-DLAMMPS_JPEG
-DLAMMPS_CURL
-DLAMMPS_SMALLBIG
sizeof(smallint): 32-bit
sizeof(imageint): 32-bit
sizeof(tagint): 32-bit
sizeof(bigint): 64-bit
Available compression formats:
Extension: .gz Command: gzip
Extension: .bz2 Command: bzip2
Extension: .zst Command: zstd
Extension: .xz Command: xz
Extension: .lzma Command: xz
Extension: .lz4 Command: lz4
Extension: .br Command: brotli
Extension: .7z Command: 7z
FFmpeg executable: /usr/bin/ffmpeg
Installed packages:
AMOEBA ASPHERE BOCS BODY BPM BROWNIAN CG-DNA CG-SPICA CLASS2 COLLOID COLVARS COMPRESS CORESHELL DIELECTRIC DIFFRACTION DIPOLE
DPD-BASIC DPD-MESO DPD-REACT DPD-SMOOTH DRUDE EFF ELECTRODE EXTRA-COMMAND EXTRA-COMPUTE EXTRA-DUMP EXTRA-FIX EXTRA-MOLECULE
EXTRA-PAIR FEP GPU GRANULAR GRAPHICS INTEL INTERLAYER KOKKOS KSPACE LATBOLTZ LEPTON MACHDYN MANYBODY MC MDI MEAM MESONT MISC
ML-HDNNP ML-IAP ML-PACE ML-POD ML-QUIP ML-SNAP MOFFF MOLECULE MOLFILE NETCDF OPENMP OPT ORIENT PERI PHONON PLUGIN PTM PYTHON
QEQ QTB REACTION REAXFF REPLICA RIGID SHOCK SMTBQ SPH SPIN SRD TALLY UEF VORONOI YAFF
Typically such a build would start with:
cmake -S cmake -B build -D BUILD_SHARED_LIBS=ON -C cmake/presets/most.cmake \
-C cmake/presets/kokkos-openmp.cmake -D PKG_PYTHON=ON -D PKG_ML_PACE=ON \
-D MLIAP_ENABLE_ACE=ON -D MLIAP_ENABLE_PYTHON=ON \
-D BUILD_LAMMPS_GUI=ON -D BUILD_LAMMPS_GUI_USE_PLUGIN=OFF
Thanks - I’ll try to figure out what’s triggering my cython version issue.
If you have time, I’d be curious to know if you have distutils installed (doesn’t seem to exist for python 3.14 as far as my attempts have shown so far), and to know if your cython installation has the line referred to in the cython issue post above (namely that cython/Cython/Build/Dependencies.py line 740 tries to import distutils.extension without falling back to setuptools.extension
No. I don’t have distutils installed.
The import doesn’t fail because setuptools comes with
/usr/lib/python3.14/site-packages/setuptools/_distutils/extension.py
Also the same for me, and when I just import distutils.extension in python myself, it works. I’ll investigate why this wasn’t happening during the lammps build process.