guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: gnu: python-xgboost: Fix build.


From: guix-commits
Subject: branch master updated: gnu: python-xgboost: Fix build.
Date: Wed, 24 Jan 2024 11:38:13 -0500

This is an automated email from the git hooks/post-receive script.

rekado pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new c3353791a4 gnu: python-xgboost: Fix build.
c3353791a4 is described below

commit c3353791a4e6242ef8dd4859a170c513899339f7
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Wed Jan 24 17:36:06 2024 +0100

    gnu: python-xgboost: Fix build.
    
    * gnu/packages/machine-learning.scm (python-xgboost)[build-system]: Use
    pyproject-build-system.
    [arguments]: Move test flags to #:test-flags; disable a few more tests, 
mostly
    to account for a removed dataset; use G-expression; remove custom 'check 
phase.
    
    Change-Id: I6841a8c159919df85acaa8558248a8775ec5be80
---
 gnu/packages/machine-learning.scm | 122 ++++++++++++++++++++++----------------
 1 file changed, 72 insertions(+), 50 deletions(-)

diff --git a/gnu/packages/machine-learning.scm 
b/gnu/packages/machine-learning.scm
index 057d90a709..8a010080d4 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -3419,57 +3419,79 @@ in a fast and accurate way.")
     (inherit xgboost)
     (name "python-xgboost")
     (source (package-source xgboost))
-    (build-system python-build-system)
+    (build-system pyproject-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"))))))))
+     (list
+      #:test-flags
+      '(list "tests/python"
+             ;; FIXME: CLI tests fail with PermissionError.
+             "--ignore" "tests/python/test_cli.py"
+             "-k"
+             (string-append
+              "not test_cli_regression_demo"
+              ;; These tests use the Boston dataset that has been
+              ;; removed from scipy.
+              " and not test_sklearn_demo"
+              " and not test_sklearn_parallel_demo"
+              " and not test_predict_shape"
+              " and not test_num_parallel_tree"
+              " and not test_boston_housing_regression"
+              " and not test_boston_housing_rf_regression"
+              " and not test_parameter_tuning"
+              " and not test_regression_with_custom_objective"
+              " and not test_RFECV"
+              ;; Pandas incompatibility? Says:
+              ;; '_CalibratedClassifier' object has no attribute
+              ;; 'base_estimator'
+              " and not test_pandas_input"
+              ;; Accuracy problems?
+              " and not test_exact"
+              " and not test_approx"
+              " and not test_hist"
+              ;; 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"))
+      #: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,") ""))
+              ;; Remove bad dataset.  This has been removed in scipy.
+              (substitute* "tests/python/testing.py"
+                (("TestDataset\\('boston', get_boston, 'reg:squarederror', 
'rmse'\\),")
+                 "")
+                (("datasets.load_boston")
+                 "datasets.load_digits"))))
+          (add-after 'install 'install-version-and-libxgboost
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let* ((pylib (string-append #$output "/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"))))))))
     (native-inputs
      (list python-pandas python-pytest python-scikit-learn))
     (inputs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]