[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#48785] [PATCH 3/3] gnu: Add python-lightgbm.
From: |
Vinicius Monego |
Subject: |
[bug#48785] [PATCH 3/3] gnu: Add python-lightgbm. |
Date: |
Tue, 1 Jun 2021 22:06:43 +0000 |
* gnu/packages/machine-learning.scm (python-lightgbm): New variable.
---
gnu/packages/machine-learning.scm | 43 +++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/gnu/packages/machine-learning.scm
b/gnu/packages/machine-learning.scm
index 1a3f647dde..900ca15b28 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1110,6 +1110,49 @@ the following advantages:
@end itemize\n")
(license license:expat)))
+(define-public python-lightgbm
+ (package
+ (inherit lightgbm)
+ (name "python-lightgbm")
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'preparations
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "HOME" "/tmp") ;to write a log file
+ ;; Move Python files to source root to silence some warnings.
+ (rename-file "python-package/setup.py" "setup.py")
+ (rename-file "python-package/README.rst" "README.rst")
+ (rename-file "python-package/lightgbm" "lightgbm")
+ (substitute* "setup.py"
+ (("version = ''")
+ (string-append "version = " "'"
+ ,(package-version lightgbm) "'")))
+ (substitute* "lightgbm/libpath.py"
+ (("lib_lightgbm_path = ''")
+ (string-append "lib_lightgbm_path = " "'"
+ (assoc-ref inputs "lightgbm")
+ "/lib" "'")))))
+ (replace 'check
+ (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+ (when tests?
+ (add-installed-pythonpath inputs outputs)
+ (invoke "python" "-m" "pytest"
+ "tests/python_package_test")))))))
+ (native-inputs
+ `(("python-psutil" ,python-psutil)
+ ("python-pytest" ,python-pytest)
+ ("python-wheel" ,python-wheel)))
+ (inputs
+ `(("lightgbm" ,lightgbm)))
+ (propagated-inputs
+ `(("python-numpy" ,python-numpy)
+ ("python-pandas" ,python-pandas)
+ ("python-scipy" ,python-scipy)
+ ("python-scikit-learn" ,python-scikit-learn)))
+ (synopsis "Python frontend for LightGBM")))
+
(define-public vowpal-wabbit
;; Language bindings not included.
(package
--
2.31.1