XGBoost "Library cannot be loaded ... libgomp.so.1" in CI
Importing xgboost loads its compiled shared library, which links against the OpenMP runtime libgomp.so.1. On a minimal image that package is absent, so the dynamic linker fails and xgboost raises an XGBoostError at import.
What this error means
import xgboost fails with "XGBoostError: ... libgomp.so.1: cannot open shared object file: No such file or directory" on a slim Debian/Alpine-based runner.
xgboost.core.XGBoostError: XGBoost Library (libxgboost.so) could not be loaded.
... libgomp.so.1: cannot open shared object file: No such file or directoryCommon causes
The OpenMP runtime is not installed
XGBoost is built with OpenMP and links libgomp.so.1 at load time. A slim base image omits libgomp1, so the import fails.
Alpine/musl base without the GNU OpenMP library
On musl images the GNU libgomp is not present by default, so the manylinux wheel cannot resolve its dependency.
How to fix it
Install the OpenMP runtime
Add libgomp1 (Debian/Ubuntu) before importing xgboost.
sudo apt-get update
sudo apt-get install -y libgomp1On Alpine, install the libgomp package
Provide the OpenMP runtime through apk so the shared object resolves.
apk add --no-cache libgompHow to prevent it
- Bake
libgomp1into custom runner images that run XGBoost. - Prefer the glibc manylinux wheels over musl where possible.
- Add an import smoke test so missing runtime libraries fail fast.