~ruther/guix-local

6877a2a08ad3bd129fbbe7d788140b7be4f21f20 — Sharlatan Hellseher 2 months ago c70f57c
gnu: python-hyperopt: Fix build.

* gnu/packages/machine-learning.scm (python-hyperopt):
[arguments] <test-flags>: Move test logic from custom 'check phase here.
<phases>: Use default 'check.
[propagated-inputs]: Remove python-numpy; add python-numpy-1 and
python-scikit-learn.

Change-Id: Ic5b8b5a2ed37417e4869b8b00110367778b2c632
Signed-off-by: Rutherther <rutherther@ditigal.xyz>
1 files changed, 30 insertions(+), 23 deletions(-)

M gnu/packages/machine-learning.scm
M gnu/packages/machine-learning.scm => gnu/packages/machine-learning.scm +30 -23
@@ 2971,6 2971,8 @@ interactive learning.")
    (license license:bsd-3)))

(define-public python-hyperopt
  ;; XXX: No releases since 2021, see:
  ;; <https://github.com/hyperopt/hyperopt/issues/943>.
  (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