GNU bug report logs - #48785
[PATCH 0/3] Update LightGBM and split frontends.

Previous Next

Package: guix-patches;

Reported by: Vinicius Monego <monego <at> posteo.net>

Date: Tue, 1 Jun 2021 22:06:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Vinicius Monego <monego <at> posteo.net>
To: 48785 <at> debbugs.gnu.org
Cc: Vinicius Monego <monego <at> posteo.net>
Subject: [bug#48785] [PATCH v6 3/3] gnu: Add python-lightgbm.
Date: Mon, 26 Jun 2023 01:06:35 +0000
* gnu/packages/machine-learning.scm (python-lightgbm): New variable.
---
Removed symlinks in favor of substituting lib_path.

 gnu/packages/machine-learning.scm | 39 +++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 17de467f46..bba89d789d 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1839,6 +1839,45 @@ (define-public lightgbm
 @end itemize\n")
     (license license:expat)))
 
+(define-public python-lightgbm
+  (package
+    (inherit lightgbm)
+    (name "python-lightgbm")
+    (source (package-source lightgbm))
+    (build-system python-build-system)
+    (arguments
+     (list #:configure-flags #~(list "--precompile") ; use our library
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'preparations
+                 (lambda _
+                   (setenv "HOME" "/tmp") ; to write a log file
+                   (rename-file "python-package/setup.py" "setup.py")
+                   (rename-file "python-package/README.rst" "README.rst")
+                   (rename-file "python-package/lightgbm" "lightgbm")
+                   ;; Write the version so the module identifies it.
+                   (with-output-to-file "lightgbm/VERSION.txt"
+                     (lambda () (display #$(package-version lightgbm))))
+                   ;; Manually install the lib.
+                   (substitute* "setup.py"
+                     (("'install_lib': CustomInstallLib,") ""))
+                   ;; Change lib_path to look for our package's lib.
+                   (substitute* "lightgbm/libpath.py"
+                     (("lib_path = \\[str\\(p\\) for p in dll_path if p\\.is_file\\(\\)]")
+                      ;; lib_path is a list of paths.
+                      (format #f "lib_path = ['~a/lib/lib_lightgbm.so']"
+                              #$(this-package-input "lightgbm"))))))
+               (replace 'check
+                 (lambda* (#:key tests? #:allow-other-keys)
+                   (when tests?
+                     (invoke "python" "-m" "pytest"
+                             "tests/python_package_test")))))))
+    (native-inputs (list python-psutil python-pytest python-wheel))
+    (inputs (list lightgbm))
+    (propagated-inputs (list python-numpy python-pandas python-scikit-learn
+                             python-scipy))
+    (synopsis "Python interface for LightGBM")))
+
 (define-public vowpal-wabbit
   ;; Language bindings not included.
   (package
-- 
2.34.1





This bug report was last modified 1 year and 354 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.