From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sMJSJty/2GD1MQEAgWs5BA (envelope-from ) for ; Sun, 27 Jun 2021 20:13:48 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id MAYCIty/2GCZTwAAB5/wlQ (envelope-from ) for ; Sun, 27 Jun 2021 18:13:48 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9E2871C7FC for ; Sun, 27 Jun 2021 20:13:47 +0200 (CEST) Received: from localhost ([::1]:54598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxYiT-0004cU-VX for larch@yhetil.org; Sun, 27 Jun 2021 13:37:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxYiN-0004WM-Cj for guix-patches@gnu.org; Sun, 27 Jun 2021 13:37:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38801) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lxYiN-0002wS-5L for guix-patches@gnu.org; Sun, 27 Jun 2021 13:37:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lxYiN-0006c9-3q for guix-patches@gnu.org; Sun, 27 Jun 2021 13:37:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48388] [PATCH v3 3/3] gnu: Add python-xgboost. Resent-From: Vinicius Monego Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Jun 2021 17:37:03 +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.162481540425384 (code B ref 48388); Sun, 27 Jun 2021 17:37:03 +0000 Received: (at 48388) by debbugs.gnu.org; 27 Jun 2021 17:36:44 +0000 Received: from localhost ([127.0.0.1]:50345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxYhz-0006bD-Dy for submit@debbugs.gnu.org; Sun, 27 Jun 2021 13:36:44 -0400 Received: from mout02.posteo.de ([185.67.36.66]:42911) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxYhu-0006aY-2V for 48388@debbugs.gnu.org; Sun, 27 Jun 2021 13:36:35 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 66DF52400FD for <48388@debbugs.gnu.org>; Sun, 27 Jun 2021 19:36:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1624815388; bh=l8xRl94sU+5iQaP0BOrvGFzCFFa7SN8eVqWyShHmSnw=; h=From:To:Cc:Subject:Date:From; b=eR51EcEvwOw7UdjS59/zZmEv9aLdfhE86xJDlAEKBB5NxdCRzrRlIK5FrOD7qExQi HSnqYFvonIS8EXQ04zhquNbkUGcPGPJ5MEOTu62iqQ3chvmihfGO1iRSNWc8YoQMXp SIdUIbTtyOYiI1Dgy2U7wP196iHWTtv4HLlUGjl3PUw1tFXnURJ2leKhQnROw3aYNF r6dh5u5wNKORVMLBwaTlGTGmkMBKWfIgR2Yx9kkZaYpXnTSr6esw/8OG87wFUE/SvR y7j5PffMVB4izKlSZ442aOAM+wfntT2GlPYRNVS6v52/gvTjqVZTFNH+WcO71gDt0g AxhvRnnDJF07A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GCdFl0PHkz6tmJ; Sun, 27 Jun 2021 19:36:26 +0200 (CEST) From: Vinicius Monego Date: Sun, 27 Jun 2021 17:30:47 +0000 Message-Id: <20210627173047.2576-3-monego@posteo.net> In-Reply-To: <20210627173047.2576-1-monego@posteo.net> References: <20210627173047.2576-1-monego@posteo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624817627; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=6itbWi/rBmOgmcxCJvzzfg7zaJs2YN+F09FM2FtNb5A=; b=V/mSdVKPbB++tMG/FNoc/oVvIQuh5udkf5UYDLccrDSp0KqjpIEXqj0IdBb7QuSTs6oVqn rc0vEWBXLqh8RWGsOKD3PvpksX5ulPUAfcY25ZUZdBg0f0BKtwTOR14lYgnLX/N2b4pqWO fpGZSVZiqeGGqUgOrULxlEz54HzDY9k9RBbIXXSuuH1mn0aRPTttbGgPl7AV6dGCJfpdNK DXkKn6iXR1pd0XIlocjh5gQmUX5qHN5gWuHwC6M9Pxgi3fj8DAVIVMzJ2DEvaCnsgDDQ8T 4aDHooumzGe/eCCiDBrtdF2vlWWrHcptvqAQ73G3tT/8cNA4movddHSPznxAFQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624817627; a=rsa-sha256; cv=none; b=GWekV+iivqZqdg7FMqRWW2CGru3AAejImXvJQCLv2vqKX+eHej5a7CYKiJ7NRynhOUhBaZ cqLr4uEBuz1IJCUVnxusUxLr00c+pyMjTfULlB0X5fzMEfd6BW5djg66OUQj3WSeL28RK8 Q43jOroYhLmm1Uh4poxIwspxSUD6Jycm86SvX/enmlxrKo/pRgftWu+zvpBD9czhPCBLuZ NuuQTldxXf4MOZGI3DRvd/LSCwRnuOJxlkezzdSz0hTw3TvgcvUoHfTmbQ4yoekOeQR0GS v+cK6Bii3doxMnN1VaMwJmv3MUt7SmTaIBEqJRqM+NmmzJJoYJJWpOPvF1uFKA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=eR51EcEv; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 5.17 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=eR51EcEv; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 9E2871C7FC X-Spam-Score: 5.17 X-Migadu-Scanner: scn0.migadu.com X-TUID: BfRhfZW//YT3 * gnu/packages/machine-learning.scm (python-xgboost): New variable. * gnu/packages/patches/python-xgboost-use-system-libxgboost.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add it. --- Changed source to inherit from xgboost. Added phase after 'install to add a VERSION file and symlink libxgboost, so it can be found at runtime. This change allowed to greatly simplify the patch. Also removed #t from phases. If this patchset is good enough now, I will do the same changes to LightGBM: http://issues.guix.gnu.org/48785 gnu/local.mk | 1 + gnu/packages/machine-learning.scm | 66 +++++++++++++++++++ ...python-xgboost-use-system-libxgboost.patch | 18 +++++ 3 files changed, 85 insertions(+) create mode 100644 gnu/packages/patches/python-xgboost-use-system-libxgboost.patch diff --git a/gnu/local.mk b/gnu/local.mk index 19db9787dc..821fd390a4 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1632,6 +1632,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-unittest2-python3-compat.patch \ %D%/packages/patches/python-unittest2-remove-argparse.patch \ %D%/packages/patches/python-waitress-fix-tests.patch \ + %D%/packages/patches/python-xgboost-use-system-libxgboost.patch \ %D%/packages/patches/pypy3-7.3.1-fix-tests.patch \ %D%/packages/patches/qemu-build-info-manual.patch \ %D%/packages/patches/qemu-CVE-2021-20203.patch \ diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index bbdfba960e..69b96ffd61 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1991,6 +1991,72 @@ 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 + (origin + (inherit (package-source xgboost)) + (patches (search-patches "python-xgboost-use-system-libxgboost.patch")))) + (build-system python-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'preparations + (lambda* (#:key inputs #:allow-other-keys) + ;; 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"))) + (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") diff --git a/gnu/packages/patches/python-xgboost-use-system-libxgboost.patch b/gnu/packages/patches/python-xgboost-use-system-libxgboost.patch new file mode 100644 index 0000000000..ce82309afd --- /dev/null +++ b/gnu/packages/patches/python-xgboost-use-system-libxgboost.patch @@ -0,0 +1,18 @@ +This patch was imported from Debian: https://sources.debian.org/src/xgboost/1.2.1-1/debian/patches/setup.py.patch/ + +Description: the libxgboost.so has been installed by another package already +Forwarded: no need +--- a/python-package/setup.py ++++ b/python-package/setup.py +@@ -286,10 +286,8 @@ + 'numpy', + 'scipy', + ], +- ext_modules=[CMakeExtension('libxgboost')], + cmdclass={ + 'build_ext': BuildExt, + 'sdist': Sdist, +- 'install_lib': InstallLib, + 'install': Install + }, + extras_require={ \ No newline at end of file -- 2.32.0