From 6877a2a08ad3bd129fbbe7d788140b7be4f21f20 Mon Sep 17 00:00:00 2001 From: Sharlatan Hellseher Date: Tue, 6 Jan 2026 14:47:57 +0000 Subject: [PATCH] gnu: python-hyperopt: Fix build. * gnu/packages/machine-learning.scm (python-hyperopt): [arguments] : Move test logic from custom 'check phase here. : Use default 'check. [propagated-inputs]: Remove python-numpy; add python-numpy-1 and python-scikit-learn. Change-Id: Ic5b8b5a2ed37417e4869b8b00110367778b2c632 Signed-off-by: Rutherther --- gnu/packages/machine-learning.scm | 53 +++++++++++++++++-------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 30ea734f6f51e27300b37825ceeb71f6b5b5fcc8..15c14b5399bb1109e2b1e01b5e11ffe224c85ef1 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -2971,6 +2971,8 @@ interactive learning.") (license license:bsd-3))) (define-public python-hyperopt + ;; XXX: No releases since 2021, see: + ;; . (package (name "python-hyperopt") (version "0.2.7") @@ -2981,39 +2983,44 @@ interactive learning.") (sha256 (base32 "0jd1ghmm423kbhjvd6pxq92y5vkz25390687fcnd7fshh3jrmy0v")))) (build-system pyproject-build-system) + ;; tests: 219 passed, 2 skipped, 7 deselected, 35331 warnings (arguments (list - #:phases - '(modify-phases %standard-phases - (replace 'check - (lambda* (#:key tests? #:allow-other-keys) - (when tests? - (invoke "python" "-m" "pytest" - ;; Needs python-pyspark. - "--ignore" "hyperopt/tests/integration/test_spark.py" - ;; Needs both python-scikit-learn and python-lightgbm. - "--ignore" "hyperopt/tests/unit/test_atpe_basic.py" - ;; The tests below need python-lightgbm. - "-k" - (string-append "not test_branin" - " and not test_distractor" - " and not test_q1lognormal" - " and not test_quadratic1" - " and not test_twoarms" - ;; XXX Type error with this version of scipy - " and not test_distribution_rvs")))))))) + #:test-flags + #~(list "--ignore=hyperopt/tests/integration/" + #$@(map (lambda (test) (string-append "--deselect=" + "hyperopt/tests/unit/" + test)) + ;; ImportError: You must install lightgbm and sklearn in + ;; order to use the ATPE algorithm. Please run `pip + ;; install lightgbm scikit-learn` and try again. These + ;; are not built in dependencies of hyperopt. + (list "test_tpe.py::TestSuggestAtpe::test_branin" + "test_tpe.py::TestSuggestAtpe::test_distractor" + "test_tpe.py::TestSuggestAtpe::test_q1lognormal" + "test_tpe.py::TestSuggestAtpe::test_quadratic1" + "test_tpe.py::TestSuggestAtpe::test_twoarms" + "test_atpe_basic.py::test_run_basic_search" + ;; TypeError: unsupported operand type(s) for -: + ;; 'method' and 'int' + "test_rdists.py::TestLogUniform::test_distribution_rvs"))))) + (native-inputs + (list python-pymongo + python-pynose ;fails more without extra test runner + python-pytest)) (propagated-inputs (list python-cloudpickle python-future python-py4j python-networkx - python-numpy + python-numpy-1 python-scipy python-setuptools ; For pkg_resources. python-six - python-tqdm)) - (native-inputs - (list python-pymongo python-pynose python-pytest)) + python-tqdm + ;; [optional] + ;; python-lightgbm + python-scikit-learn)) (home-page "https://hyperopt.github.io/hyperopt/") (synopsis "Library for hyperparameter optimization") (description "Hyperopt is a Python library for serial and parallel