From patchwork Sun Jun 27 23:11:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Monego X-Patchwork-Id: 30750 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 3FA0327BC81; Mon, 28 Jun 2021 00:13:09 +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,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 C84E627BC78 for ; Mon, 28 Jun 2021 00:13:08 +0100 (BST) Received: from localhost ([::1]:51984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxdxb-0006bF-Lh for patchwork@mira.cbaines.net; Sun, 27 Jun 2021 19:13:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxdxW-0006b6-DC for guix-patches@gnu.org; Sun, 27 Jun 2021 19:13:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lxdxW-0006Mc-4B for guix-patches@gnu.org; Sun, 27 Jun 2021 19:13:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lxdxV-0006PF-Vz for guix-patches@gnu.org; Sun, 27 Jun 2021 19:13:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48388] [PATCH v4 3/3] gnu: Add python-xgboost. References: <20210512235649.516594-1-monego@posteo.net> In-Reply-To: <20210512235649.516594-1-monego@posteo.net> Resent-From: Vinicius Monego Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Jun 2021 23:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48388 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48388@debbugs.gnu.org Cc: Vinicius Monego Received: via spool by 48388-submit@debbugs.gnu.org id=B48388.162483556624603 (code B ref 48388); Sun, 27 Jun 2021 23:13:01 +0000 Received: (at 48388) by debbugs.gnu.org; 27 Jun 2021 23:12:46 +0000 Received: from localhost ([127.0.0.1]:50464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxdxF-0006Ol-Uh for submit@debbugs.gnu.org; Sun, 27 Jun 2021 19:12:46 -0400 Received: from mout02.posteo.de ([185.67.36.66]:43647) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxdxD-0006OW-GN for 48388@debbugs.gnu.org; Sun, 27 Jun 2021 19:12:45 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 927B72400E5 for <48388@debbugs.gnu.org>; Mon, 28 Jun 2021 01:12:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1624835556; bh=IDTpxDDMrpUUvwuHsz9J1z7B1YeYHD+zaD4Cw0xMyiw=; h=From:To:Cc:Subject:Date:From; b=Wxe2kyJHNT+sJq+hohhpA/LbsQYq/lu2NLOkdCLbe0Y0txlyvqihBBQNj8BA7Wb8z e//Wn3mX7x/SquT4YtZdzQ5gvVI1EjOIU6zs1fUKQx7fgym+9TIFt14wk+23xiBEnA V9n4jeiVsvZC5W6NdWoDzakJj91voxjxE2oGJ0M0cJiDVzNZFFxKGGLQMlDqtZMLZ0 K00eZyJFhtkBoAAh1YiAZAQxzQIoFlaY8tqA+KIxTTunPZg/scaHU0v0dzPG00OmBa fQGtYeTH9/kWP9RcT7ApbePmVE/qsKqORodJW3qFSdHterY816wL4xCgBJ8dfmkDCZ Vpwf/0enBivWg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GCmjZ5Jl5z6tmF; Mon, 28 Jun 2021 01:12:34 +0200 (CEST) From: Vinicius Monego Date: Sun, 27 Jun 2021 23:11:56 +0000 Message-Id: <20210627231156.25391-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-xgboost): New variable. --- Replaced the patch file with substitutions in 'preparations and changed the lambda arguments to _. gnu/packages/machine-learning.scm | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 726d491868..b8d79821e0 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1991,6 +1991,73 @@ tree boosting (also known as GBDT, GBM) that solve many data science problems in a fast and accurate way.") (license license:asl2.0))) +(define-public python-xgboost + (package + (inherit xgboost) + (name "python-xgboost") + (source (package-source xgboost)) + (build-system python-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'preparations + (lambda _ + ;; Move python-package content to parent directory to silence + ;; some warnings about files not being found if we chdir. + (rename-file "python-package/xgboost" "xgboost") + (rename-file "python-package/README.rst" "README.rst") + (rename-file "python-package/setup.cfg" "setup.cfg") + (rename-file "python-package/setup.py" "setup.py") + ;; Skip rebuilding libxgboost.so. + (substitute* "setup.py" + (("ext_modules=\\[CMakeExtension\\('libxgboost'\\)\\],") "") + (("'install_lib': InstallLib,") "")))) + (add-after 'install 'install-version-and-libxgboost + (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")) + (xgbdir (string-append pylib "/xgboost")) + (version-file (string-append xgbdir "/VERSION")) + (libxgboost (string-append (assoc-ref inputs "xgboost") + "/lib/libxgboost.so"))) + (with-output-to-file version-file + (lambda () + (display ,(package-version xgboost)))) + (mkdir-p (string-append xgbdir "/lib")) + (symlink libxgboost (string-append xgbdir "/lib" + "/libxgboost.so"))))) + (replace 'check + ;; Python-specific tests are located in tests/python. + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (add-installed-pythonpath inputs outputs) + (invoke "pytest" "tests/python" + ;; FIXME: CLI tests fail with PermissionError. + "--ignore" "tests/python/test_cli.py" "-k" + (string-append + "not test_cli_regression_demo" + ;; The tests below open a network connection. + " and not test_model_compatibility" + " and not test_get_group" + " and not test_cv_no_shuffle" + " and not test_cv" + " and not test_training" + ;; "'['./runexp.sh']' returned non-zero exit status 1" + " and not test_cli_binary_classification")))))))) + (native-inputs + `(("python-pandas" ,python-pandas) + ("python-pytest" ,python-pytest) + ("python-scikit-learn" ,python-scikit-learn))) + (inputs + `(("xgboost" ,xgboost))) + (propagated-inputs + `(("python-numpy" ,python-numpy) + ("python-scipy" ,python-scipy))) + (synopsis "Python interface for the XGBoost library"))) + (define-public python-iml (package (name "python-iml")