mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
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
This commit is contained in:
parent
2c5faa9ab8
commit
c3353791a4
1 changed files with 72 additions and 50 deletions
|
@ -3419,57 +3419,79 @@ (define-public python-xgboost
|
|||
(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
|
||||
|
|
Loading…
Reference in a new issue