From patchwork Fri Oct 8 02:54:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Monego X-Patchwork-Id: 33686 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1641327BBE3; Fri, 8 Oct 2021 03:55:32 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CD2FF27BBE1 for ; Fri, 8 Oct 2021 03:55:31 +0100 (BST) Received: from localhost ([::1]:58150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYg2k-0007P8-Up for patchwork@mira.cbaines.net; Thu, 07 Oct 2021 22:55:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYg2J-00077M-Ak for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37283) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYg2J-0005zU-3A for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mYg2J-0008HF-2S for guix-patches@gnu.org; Thu, 07 Oct 2021 22:55:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48785] [PATCH v3 3/3] gnu: Add python-lightgbm. Resent-From: Vinicius Monego Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 08 Oct 2021 02:55:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48785 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48785@debbugs.gnu.org Cc: Vinicius Monego Received: via spool by 48785-submit@debbugs.gnu.org id=B48785.163366167831769 (code B ref 48785); Fri, 08 Oct 2021 02:55:03 +0000 Received: (at 48785) by debbugs.gnu.org; 8 Oct 2021 02:54:38 +0000 Received: from localhost ([127.0.0.1]:48827 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYg1t-0008GF-UF for submit@debbugs.gnu.org; Thu, 07 Oct 2021 22:54:38 -0400 Received: from mout01.posteo.de ([185.67.36.65]:35741) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYg1p-0008Fg-PA for 48785@debbugs.gnu.org; Thu, 07 Oct 2021 22:54:34 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 23E79240026 for <48785@debbugs.gnu.org>; Fri, 8 Oct 2021 04:54:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1633661668; bh=fKv8AJpRvGIjhAg0SM7ANLDe6TuoGHeOy4B7aXtBRhg=; h=From:To:Cc:Subject:Date:From; b=i0Au1Z7Ci6oEGomrYukiHle4u3FyOUNIwK/s+nrXdBIZBcwq8Ugfadbfs0aaPB17E mC+TrQC/+clK0uP9sqLiw/jGUN6X5BLSR38EERJe4qpi1s1ztmG7F/KHHYE+mHIhwz 1GeXeTc4p8OkBdTN2zQA2aDN2SSYSiogoEXRkbG2U/HJq9UUo3qSXC1iCXCpc+244a 2oM4vrvZYCzBS0yWmuLCjvdhJstR28QpgL0jT3R5wFAljioxPAgU+USNpUpLzgf4jI x2IZ/oVZBxP5BtHJC5ddnCY3Xj/a2/dFPiTMOeLOVeT0RH3+G1P7uipo5pkcX7e5Eq KR54Gp3YIe0kw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4HQXpW2RYMz9rxG; Fri, 8 Oct 2021 04:54:27 +0200 (CEST) From: Vinicius Monego Date: Fri, 8 Oct 2021 02:54:09 +0000 Message-Id: <20211008025409.80602-3-monego@posteo.net> In-Reply-To: <20211008025409.80602-1-monego@posteo.net> References: <20211008025409.80602-1-monego@posteo.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/machine-learning.scm (python-lightgbm): New variable. --- Rebase only. gnu/packages/machine-learning.scm | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 99d864a25c..e7ce107637 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1271,6 +1271,65 @@ the following advantages: @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 + `(#:configure-flags (list "--precompile") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'preparations + (lambda _ + (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") + ;; Install version file to read the library's version. + (with-output-to-file "lightgbm/VERSION.txt" + (lambda () + (display ,(package-version lightgbm)))) + ;; Skip building the shared library. + (substitute* "setup.py" + (("'install_lib': CustomInstallLib,") "")))) + (add-after 'install 'install-liblightgbm + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (pylib (string-append out "/lib/python" + ,(version-major+minor + (package-version python)) + "/site-packages")) + (lgbdir (string-append pylib "/lightgbm")) + (lib-lightgbm (string-append (assoc-ref inputs "lightgbm") + "/lib/lib_lightgbm.so"))) + ;; This symlink is necessary for tests. + (symlink lib-lightgbm "lightgbm/lib_lightgbm.so") + ;; And this one for runtime. + (mkdir-p (string-append lgbdir "/lib")) + (symlink lib-lightgbm (string-append lgbdir + "/lib_lightgbm.so"))))) + (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-scikit-learn" ,python-scikit-learn) + ("python-scipy" ,python-scipy))) + (synopsis "Python frontend for LightGBM"))) + (define-public vowpal-wabbit ;; Language bindings not included. (package