python-lightgbm-cpu-only

LOW
maintainer marco.righi 0 votes scanned 2026-10-28 09:50:05.638525
View on AUR
Why flagged

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

Triggered rules

Low Few votes, recently uploaded zero_votes_recent

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

PKGBUILD

1# Maintainer: Marco Righi <marco.righi@gmail.com>
2# CPU-only build of the upstream LightGBM Python distribution.
3
4pkgname=python-lightgbm-cpu-only
5pkgver=4.7.0
6pkgrel=1
7pkgdesc='LightGBM Python bindings with CPU/OpenMP support, without GPU or CUDA'
8arch=('x86_64')
9url='https://github.com/lightgbm-org/LightGBM'
10license=('MIT')
11depends=('python' 'python-numpy' 'python-scipy' 'python-narwhals' 'gcc-libs' 'glibc')
12makedepends=('cmake' 'ninja' 'python-build' 'python-installer' 'python-scikit-build-core' 'binutils')
13optdepends=(
14 'python-scikit-learn: scikit-learn estimator interface'
15 'python-pandas: pandas DataFrame support'
16 'python-matplotlib: plotting utilities'
17 'python-graphviz: tree visualization'
18 'python-dask: distributed data interfaces'
19 'python-distributed: Dask distributed execution'
20 'python-joblib: optional parallelism helpers'
21 'python-psutil: optional system resource queries'
22)
23provides=("python-lightgbm=${pkgver}")
24conflicts=('python-lightgbm' 'python-lightgbm-cl' 'python-lightgbm-cuda' 'python-lightgbm-nacci')
25source=("https://files.pythonhosted.org/packages/source/l/lightgbm/lightgbm-${pkgver}.tar.gz")
26sha256sums=('f8e20f682c9aabd000bcf4a7ed8aa6f473c1adfecccae34ec24e823d156f4af0')
27
28build() {
29 # Prevent absolute private source paths in C/C++ __FILE__ and debug records.
30 # GCC's -ffile-prefix-map covers both macro and debug path remapping.
31 local prefix_map="-ffile-prefix-map=${srcdir}=/usr/src/${pkgname}-${pkgver}"
32 export CFLAGS="${CFLAGS:-} ${prefix_map}"
33 export CXXFLAGS="${CXXFLAGS:-} ${prefix_map}"
34 cd "${srcdir}/lightgbm-${pkgver}"
35 python -m build --wheel --no-isolation \
36 -Ccmake.define.USE_CUDA=OFF \
37 -Ccmake.define.USE_GPU=OFF \
38 -Ccmake.define.USE_OPENMP=ON
39}
40
41check() {
42 local wheel_dir="${srcdir}/wheel-check-lightgbm"
43 install -d "$wheel_dir"
44 python -m zipfile -e "${srcdir}/lightgbm-${pkgver}/dist/"*.whl "$wheel_dir"
45 PYTHONPATH="$wheel_dir" python - <<'PY'
46import os
47from pathlib import Path
48import numpy as np
49import lightgbm as lgb
50
51root = Path(os.environ['PYTHONPATH']).resolve()
52assert Path(lgb.__file__).resolve().is_relative_to(root)
53assert lgb.__version__ == '4.7.0'
54X = np.array([[0, 0], [1, 0], [0, 1], [1, 1], [2, 0], [0, 2], [2, 2], [3, 3]], dtype=float)
55y = np.array([0, 0, 0, 1, 1, 1, 1, 1])
56train = lgb.Dataset(X, label=y)
57model = lgb.train({'objective': 'binary', 'verbosity': -1, 'num_threads': 1,
58 'min_data_in_leaf': 1}, train, num_boost_round=3)
59assert np.isfinite(model.predict(X)).all()
60print('LightGBM CPU smoke test: PASS')
61PY
62 local shared_library
63 shared_library="$(find "$wheel_dir/lightgbm" -name 'lib_lightgbm.so' -print -quit)"
64 test -n "$shared_library"
65 if readelf -d "$shared_library" | grep -Ei '(NEEDED.*(cuda|cublas|nccl|OpenCL))'; then
66 echo 'Unexpected GPU dependency in CPU-only LightGBM build' >&2
67 return 1
68 fi
69}
70
71package() {
72 cd "${srcdir}/lightgbm-${pkgver}"
73 python -m installer --destdir="${pkgdir}" dist/*.whl
74 # LightGBM uses MIT: Arch requires the actual license text in the package.
75 # Prefer the distribution's own LICENSE; fall back to wheel-installed metadata.
76 local license_src=""
77 local candidate
78 for candidate in \
79 "${srcdir}/lightgbm-${pkgver}/LICENSE" \
80 "${srcdir}/lightgbm-${pkgver}/python-package/LICENSE" \
81 "${srcdir}/lightgbm-${pkgver}/lightgbm/LICENSE"; do
82 if [[ -f "$candidate" ]]; then
83 license_src="$candidate"
84 break
85 fi
86 done
87 if [[ -z "$license_src" ]]; then
88 license_src="$(find "${pkgdir}/usr/lib" -type f \
89 -path '*/lightgbm-*.dist-info/licenses/LICENSE' -print -quit)"
90 fi
91 if [[ -z "$license_src" || ! -f "$license_src" ]]; then
92 echo 'ERROR: LightGBM MIT LICENSE not found in distribution; refusing incomplete package' >&2
93 return 1
94 fi
95 install -Dm644 "$license_src" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
96}
97

Scan history

Scanned at (UTC)SeverityRules
2026-10-28 09:50:05 Low 1

Report a package

Reports go to the AURWatch maintainer (one person) and are read by hand. No login required.

0 / 4000
Your suggestion