From patchwork Sun Jun 27 17:30:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Monego X-Patchwork-Id: 30745 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 D821327BC81; Sun, 27 Jun 2021 18:37:11 +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 A3FE427BC78 for ; Sun, 27 Jun 2021 18:37:11 +0100 (BST) Received: from localhost ([::1]:54516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxYiU-0004YY-LN for patchwork@mira.cbaines.net; Sun, 27 Jun 2021 13:37:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxYiM-0004Vc-Vy for guix-patches@gnu.org; Sun, 27 Jun 2021 13:37:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38800) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lxYiM-0002wL-Ot for guix-patches@gnu.org; Sun, 27 Jun 2021 13:37:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lxYiM-0006c2-NX for guix-patches@gnu.org; Sun, 27 Jun 2021 13:37:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48388] [PATCH v3 1/3] gnu: Add dmlc-core. 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 17:37:02 +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.162481539925374 (code B ref 48388); Sun, 27 Jun 2021 17:37:02 +0000 Received: (at 48388) by debbugs.gnu.org; 27 Jun 2021 17:36:39 +0000 Received: from localhost ([127.0.0.1]:50343 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxYhy-0006bA-SE for submit@debbugs.gnu.org; Sun, 27 Jun 2021 13:36:39 -0400 Received: from mout02.posteo.de ([185.67.36.66]:52549) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxYhr-0006aR-Ss for 48388@debbugs.gnu.org; Sun, 27 Jun 2021 13:36:34 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 59A312400E5 for <48388@debbugs.gnu.org>; Sun, 27 Jun 2021 19:36:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1624815385; bh=3VEFdUTVMGkO4BIIzxeH+UgUiIz30B/8A+mvqKR9yKg=; h=From:To:Cc:Subject:Date:From; b=rNsVPSPl8wQ17pdAHiKWLhaU70sSPHESKJ7NZ7iOZvAZFfE+h2XEq7zMr2Onb6Zfg nKpLi+QqVZORTxrbsbXQ1iZCeJ04y2gBm76vsPFxvOAL+eTD3UyvbZrucq7TlygzSJ Ic4MWxaP9fhuftlG5rPOedlMv1grH4LSSr161+PkrWrNM0I781Fh/yImuPysecQREM ZgInd8I+UCPquqP8G5WMIcIZZnY3ZK6e7gl9H3UK4f7gfPkqUwrwiXW5+FpdPE5/uB Sei6pxs3+Il+QshIjeH/qCVzd0SvAn1OjiBGZOsceY1umOofgoWetpm3QZXTupIV1f GXnENN8gxjfcQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GCdFg5tvNz6tmW; Sun, 27 Jun 2021 19:36:23 +0200 (CEST) From: Vinicius Monego Date: Sun, 27 Jun 2021 17:30:45 +0000 Message-Id: <20210627173047.2576-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 (dmlc-core): New variable. --- No changes. gnu/packages/machine-learning.scm | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 837ebbba67..9d6c5505f7 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1927,6 +1927,38 @@ together building blocks and a subclassing API with an imperative style for advanced research.") (license license:asl2.0))) +(define-public dmlc-core + ;; Version 0.4 is too old for xgboost. + (let ((version "0.5") + (commit "f00e3ec7abc9f293a1b7061157b0a4e22a735cf5") + (revision "0")) + (package + (name "dmlc-core") + (version (git-version version revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/dmlc/dmlc-core") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1x4ad1jhn84fywlk031fmv1kxyiscclmrqn9hhj8gz0mh7z9vcrh")))) + (build-system cmake-build-system) + (arguments + `(#:configure-flags + (list "-DGOOGLE_TEST=ON"))) + (native-inputs + `(("googletest" ,googletest) + ("python" ,python-wrapper))) + (home-page "https://github.com/dmlc/dmlc-core") + (synopsis "Common bricks library for machine learning") + (description + "DMLC-Core is the backbone library to support all DMLC projects, +offers the bricks to build efficient and scalable distributed machine +learning libraries.") + (license license:asl2.0)))) + (define-public python-iml (package (name "python-iml") From patchwork Sun Jun 27 17:30:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Monego X-Patchwork-Id: 30747 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 0AF1527BC81; Sun, 27 Jun 2021 18:37:26 +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 70EB427BC78 for ; Sun, 27 Jun 2021 18:37:25 +0100 (BST) Received: from localhost ([::1]:55460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxYii-0005BE-Cl for patchwork@mira.cbaines.net; Sun, 27 Jun 2021 13:37:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxYiM-0004V7-MJ for guix-patches@gnu.org; Sun, 27 Jun 2021 13:37:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38799) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lxYiM-0002wG-Er for guix-patches@gnu.org; Sun, 27 Jun 2021 13:37:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lxYiM-0006bu-BI for guix-patches@gnu.org; Sun, 27 Jun 2021 13:37:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48388] [PATCH v3 2/3] gnu: Add xgboost. Resent-From: Vinicius Monego Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Jun 2021 17:37:02 +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.162481539525354 (code B ref 48388); Sun, 27 Jun 2021 17:37:02 +0000 Received: (at 48388) by debbugs.gnu.org; 27 Jun 2021 17:36:35 +0000 Received: from localhost ([127.0.0.1]:50340 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxYhu-0006am-52 for submit@debbugs.gnu.org; Sun, 27 Jun 2021 13:36:34 -0400 Received: from mout02.posteo.de ([185.67.36.66]:36141) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxYhs-0006aW-CR for 48388@debbugs.gnu.org; Sun, 27 Jun 2021 13:36:33 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id BAB642400FC for <48388@debbugs.gnu.org>; Sun, 27 Jun 2021 19:36:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1624815386; bh=S9mfeahNo5Hkic/abvFhNcrOY9vnZnye5McLefaiU0E=; h=From:To:Cc:Subject:Date:From; b=RErBS6aEXQrh0dcBeWmhhxA+VcbFPsVCubyzw0lgcwg65WS92h0m2os1IvYl29iXR QZrvkueJ9eOYwheFqCWZ0TsEfOWUd9r4DmN257Z6yhAU54/XmnELpX6KGlL42ID+zv VhKv8wkaRWGmlF3kSU+2MZqRPkkPCQrpAib31edTzrunBDdyCARupnQQf6rHdAL6FW uxiKRzshm5URjQWY4J2C80IsNMbSJ0hezj32l0p3hmykNrIkW3BpSjJWSb+B44Oclb GnxBLH9Gf5wzsfYcCNIr648zLtxleuBJtwVPK+hYU1FLiII3OAAVGmL/2krXfgbPks K9dktxbMNnrqg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GCdFj3C68z6tmQ; Sun, 27 Jun 2021 19:36:25 +0200 (CEST) From: Vinicius Monego Date: Sun, 27 Jun 2021 17:30:46 +0000 Message-Id: <20210627173047.2576-2-monego@posteo.net> In-Reply-To: <20210627173047.2576-1-monego@posteo.net> References: <20210627173047.2576-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 (xgboost): New variable. * gnu/packages/patches/xgboost-use-system-dmlc-core.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add it. --- Removed the python patch, updated to 1.4.2 and removed "in C++" from synopsis. gnu/local.mk | 1 + gnu/packages/machine-learning.scm | 32 +++++++++++++++++ .../xgboost-use-system-dmlc-core.patch | 34 +++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 gnu/packages/patches/xgboost-use-system-dmlc-core.patch diff --git a/gnu/local.mk b/gnu/local.mk index f7ff9af997..19db9787dc 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1842,6 +1842,7 @@ dist_patch_DATA = \ %D%/packages/patches/xf86-video-voodoo-pcitag.patch \ %D%/packages/patches/xfce4-panel-plugins.patch \ %D%/packages/patches/xfce4-settings-defaults.patch \ + %D%/packages/patches/xgboost-use-system-dmlc-core.patch \ %D%/packages/patches/xmonad-dynamic-linking.patch \ %D%/packages/patches/xplanet-1.3.1-cxx11-eof.patch \ %D%/packages/patches/xplanet-1.3.1-libdisplay_DisplayOutput.cpp.patch \ diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 9d6c5505f7..bbdfba960e 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1959,6 +1959,38 @@ offers the bricks to build efficient and scalable distributed machine learning libraries.") (license license:asl2.0)))) +(define-public xgboost + (package + (name "xgboost") + (version "1.4.2") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/dmlc/xgboost") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (patches (search-patches "xgboost-use-system-dmlc-core.patch")) + (sha256 + (base32 "00liz816ahk9zj3jv3m2fqwlf6xxfbgvpmpl72iklx32vl192w5d")))) + (build-system cmake-build-system) + (arguments + `(#:configure-flags (list "-DGOOGLE_TEST=ON"))) + (native-inputs + `(("googletest" ,googletest) + ("python" ,python-wrapper))) + (inputs + `(("dmlc-core" ,dmlc-core))) + (home-page "https://xgboost.ai/") + (synopsis "Gradient boosting (GBDT, GBRT or GBM) library") + (description + "XGBoost is an optimized distributed gradient boosting library designed +to be highly efficient, flexible and portable. It implements machine learning +algorithms under the Gradient Boosting framework. XGBoost provides a parallel +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-iml (package (name "python-iml") diff --git a/gnu/packages/patches/xgboost-use-system-dmlc-core.patch b/gnu/packages/patches/xgboost-use-system-dmlc-core.patch new file mode 100644 index 0000000000..c654694fec --- /dev/null +++ b/gnu/packages/patches/xgboost-use-system-dmlc-core.patch @@ -0,0 +1,34 @@ +From 34167cc105e47589b86b6f62da76e0ab744002dd Mon Sep 17 00:00:00 2001 +From: Vinicius Monego +Date: Tue, 11 May 2021 19:35:30 -0300 +Subject: [PATCH] Use dmlc-core from Guix. + +--- +This patch is a subset of the following Debian patch: https://sources.debian.org/src/xgboost/1.2.1-1/debian/patches/cmake.patch/ + +Rabit is now developed as part of xgboost, so we don't build it separately. + + CMakeLists.txt | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6cc19fbd..3b42bc17 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -150,11 +150,9 @@ endif (USE_OPENMP) + + # dmlc-core + msvc_use_static_runtime() +-add_subdirectory(${xgboost_SOURCE_DIR}/dmlc-core) +-set_target_properties(dmlc PROPERTIES +- CXX_STANDARD 14 +- CXX_STANDARD_REQUIRED ON +- POSITION_INDEPENDENT_CODE ON) ++add_library(dmlc SHARED IMPORTED) ++find_library(DMLC_LIBRARY dmlc) ++set_property(TARGET dmlc PROPERTY IMPORTED_LOCATION "${DMLC_LIBRARY}") + if (MSVC) + target_compile_options(dmlc PRIVATE + -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE) +-- +2.31.1 From patchwork Sun Jun 27 17:30:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Monego X-Patchwork-Id: 30746 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 40DD627BC81; Sun, 27 Jun 2021 18:37:14 +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 69B6527BC78 for ; Sun, 27 Jun 2021 18:37:13 +0100 (BST) Received: from localhost ([::1]:54598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxYiW-0004cU-FB for patchwork@mira.cbaines.net; Sun, 27 Jun 2021 13:37:12 -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 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. * 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