[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
155/242: gnu: python-numpy: Update to 1.21.6 and parallelize build/tests
From: |
guix-commits |
Subject: |
155/242: gnu: python-numpy: Update to 1.21.6 and parallelize build/tests. |
Date: |
Thu, 12 May 2022 14:14:23 -0400 (EDT) |
apteryx pushed a commit to branch master
in repository guix.
commit 411cd4345f858d038b8761b9c8bbe902aedc3e23
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Mon Apr 18 14:28:31 2022 -0400
gnu: python-numpy: Update to 1.21.6 and parallelize build/tests.
* gnu/packages/python-xyz.scm (python-numpy): Update to 1.21.6. Move inputs
and native-inputs fields after arguments. Use gexps.
[modules]: New argument.
[phases]{parallelize-build}: New phase.
{configure-blas}: Format via (ice-9 format).
{fix-executable-paths}: Use search-file-input. Remove obsolete
system_info.py
substitution.
{check}: Remove extraneous add-installed-pythonpath and setenv calls.
Provide
the '-n' pytest-xdist option.
[native-inputs]: Use python-hypothesis-next.
(python-numpy-next): Inherit from python-numpy.
(python2-numpy): Adjust for gexps.
[phases]{delete-failing-test}: Rename to...
{delete-failing-tests}: ... this.
(python2-numpy-1.8): Likewise, and delete 'delete-failing-tests' phase.
Disable tests.
[native-inputs]: Define as the empty list.
---
gnu/packages/python-xyz.scm | 194 +++++++++++++++++++++-----------------------
1 file changed, 93 insertions(+), 101 deletions(-)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 4cd26d4038..7840ccfcd1 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -5703,10 +5703,13 @@ writing C extensions for Python as easy as Python
itself.")
"17fqacrpis05w1rpi7d7sbimrk20xf8h6d3vrz5nf6ix3899abil"))))
(properties '())))
-(define-public python-numpy-next
+;; NOTE: when upgrading numpy please make sure that python-numba,
+;; python-pandas and python-scipy still build, as these three packages are
+;; often used together.
+(define-public python-numpy
(package
- (name "python-numpy-next")
- (version "1.22.3")
+ (name "python-numpy")
+ (version "1.21.6")
(source
(origin
(method url-fetch)
@@ -5715,50 +5718,57 @@ writing C extensions for Python as easy as Python
itself.")
version "/numpy-" version ".tar.gz"))
(sha256
(base32
- "19dw91pqbqcniw2z57kiyqs1qp56g7kqy1bdyv664g8s62sc01m9"))))
+ "0b0c5y35rd3mvwfk5is1d5ppfw9nl4d2rgx9xkwh1p0w394wdvyl"))))
(build-system python-build-system)
- (inputs
- (list openblas))
- (native-inputs
- (list python-cython python-hypothesis-6.23 python-pytest
- python-pytest-xdist gfortran))
(arguments
- `(#:phases
- (modify-phases %standard-phases
- (add-before 'build 'configure-blas
- (lambda* (#:key inputs #:allow-other-keys)
- (call-with-output-file "site.cfg"
- (lambda (port)
- (format port
- "\
+ (list
+ #:modules '((guix build utils)
+ (guix build python-build-system)
+ (ice-9 format))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'build 'parallelize-build
+ (lambda _
+ (setenv "NPY_NUM_BUILD_JOBS"
+ (number->string (parallel-job-count)))))
+ (add-before 'build 'configure-blas
+ (lambda* (#:key inputs #:allow-other-keys)
+ (call-with-output-file "site.cfg"
+ (lambda (port)
+ (format port
+ "\
[openblas]
libraries = openblas
library_dirs = ~a/lib
-include_dirs = ~a/include
-"
- (assoc-ref inputs "openblas")
- (assoc-ref inputs "openblas"))))))
- (add-before 'build 'fix-executable-paths
- (lambda* (#:key inputs #:allow-other-keys)
- ;; Make /gnu/store/...-bash-.../bin/sh the default shell,
- ;; instead of /bin/sh.
- (substitute* "numpy/distutils/exec_command.py"
- (("(os.environ.get\\('SHELL', ')(/bin/sh'\\))" match
match-start match-end)
- (string-append match-start (assoc-ref inputs "bash")
match-end)))
- ;; Use "gcc" executable, not "cc".
- (substitute* "numpy/distutils/system_info.py"
- (("c = distutils\\.ccompiler\\.new_compiler\\(\\)")
- "c = distutils.ccompiler.new_compiler();
c.set_executables(compiler='gcc',compiler_so='gcc',linker_exe='gcc',linker_so='gcc
-shared')"))))
- (replace 'check
- (lambda* (#:key tests? outputs inputs #:allow-other-keys)
- (when tests?
- ;; Make installed package available for running the tests.
- (add-installed-pythonpath inputs outputs)
- ;; Make sure "f2py" etc is found.
- (setenv "PATH" (string-append (assoc-ref outputs "out") "/bin"
- ":" (getenv "PATH")))
- (invoke "./runtests.py"
- "-j" (number->string (parallel-job-count)))))))))
+include_dirs = ~:*~a/include~%" #$(this-package-input "openblas"))))))
+ (add-before 'build 'fix-executable-paths
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Make /gnu/store/...-bash-.../bin/sh the default shell,
+ ;; instead of /bin/sh.
+ (substitute* "numpy/distutils/exec_command.py"
+ (("'/bin/sh'")
+ (format #f "~s" (search-input-file inputs "bin/bash"))))))
+ (replace 'check
+ (lambda* (#:key tests? outputs inputs #:allow-other-keys)
+ (when tests?
+ (invoke "./runtests.py" "-vv" "--no-build" "--mode=fast"
+ "-j" (number->string (parallel-job-count))
+ ;; Contrary to scipy, the runtests.py script of numpy
+ ;; does *not* automatically provide -n when -j is used
+ ;; (see: https://github.com/numpy/numpy/issues/21359).
+ "--" "-n" (number->string (parallel-job-count))
+ "-k" (string-append
+ ;; These tests may fail on 32-bit systems (see:
+ ;; https://github.com/numpy/numpy/issues/18387).
+ "not test_float_remainder_overflow "
+ "and not test_pareto"))))))))
+ (native-inputs
+ (list python-cython
+ python-hypothesis-next
+ python-pytest
+ python-pytest-xdist
+ gfortran))
+ (inputs (list bash openblas))
(home-page "https://numpy.org")
(synopsis "Fundamental package for scientific computing with Python")
(description "NumPy is the fundamental package for scientific computing
@@ -5769,10 +5779,26 @@ capabilities.")
(properties `((python2-variant . ,(delay python2-numpy))))
(license license:bsd-3)))
+(define-public python-numpy-next
+ (package
+ (inherit python-numpy)
+ (name "python-numpy-next")
+ (version "1.22.3")
+ (source
+ (origin
+ (inherit (package-source python-numpy))
+ (method url-fetch)
+ (uri (string-append
+ "https://github.com/numpy/numpy/releases/download/v"
+ version "/numpy-" version ".tar.gz"))
+ (sha256
+ (base32
+ "19dw91pqbqcniw2z57kiyqs1qp56g7kqy1bdyv664g8s62sc01m9"))))))
+
;; Numpy 1.16.x are the last versions that support Python 2.
(define-public python2-numpy
(let ((numpy (package-with-python2
- (strip-python2-variant python-numpy-next))))
+ (strip-python2-variant python-numpy))))
(package
(inherit numpy)
(name "python2-numpy")
@@ -5788,80 +5814,46 @@ capabilities.")
(arguments
(substitute-keyword-arguments (package-arguments numpy)
((#:phases phases)
- `(modify-phases ,phases
- (add-after 'unpack 'delete-failing-test
- (lambda _
- ;; There's just one failing test here.
- (delete-file "numpy/linalg/tests/test_linalg.py")
- ;; ...and this one depends on the previous one.
- (delete-file
"numpy/matrixlib/tests/test_matrix_linalg.py")))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'delete-failing-tests
+ (lambda _
+ ;; There's just one failing test here.
+ (delete-file "numpy/linalg/tests/test_linalg.py")
+ ;; ...and this one depends on the previous one.
+ (delete-file "numpy/matrixlib/tests/test_matrix_linalg.py")))
+ (replace 'check
+ ;; Older versions don't cope well with the extra Pytest
+ ;; options, so remove them.
+ (lambda* (#:key tests? outputs inputs #:allow-other-keys)
+ (when tests?
+ (invoke "./runtests.py" "-vv" "--no-build" "--mode=fast"
+ "-j" (number->string (parallel-job-count))))))))))
(native-inputs
(list python2-cython python2-pytest gfortran)))))
-;; Needed by python-numba, see https://github.com/numba/numba/issues/7176
-(define-public python-numpy-1.20
- (package
- (inherit python-numpy-next)
- (name "python-numpy")
- (version "1.20.3")
- (source (origin
- (method url-fetch)
- (uri (string-append
- "https://github.com/numpy/numpy/releases/download/v"
- version "/numpy-" version ".tar.gz"))
- (sha256
- (base32
- "140zq9snx0di4id4g97vaw9zz8x2rfla5lp3a70j666f5030yd5p"))))
- ;; python-numpy-next replaced python-hypothesis with
- ;; python-hypothesis-6.23. We switch it back here, to prevent
- ;; python-numpy-1.20 and its numerous dependents from being rebuilt.
- (native-inputs
- (list python-cython python-hypothesis python-pytest
- python-pytest-xdist gfortran))
- ;; 92 tests fail, many of them because parts of the temp file name
- ;; accidentally ends up in a comparison.
- (arguments
- (substitute-keyword-arguments (package-arguments python-numpy-next)
- ((#:tests? _ #t) #f)))))
-
-;; NOTE: when upgrading numpy please make sure that python-pandas and
-;; python-scipy still build, as these three packages are often used together.
-(define-public python-numpy python-numpy-1.20)
-
;; NOTE: NumPy 1.8 is packaged only for Python 2 because it is of
;; interest only for legacy code going back to NumPy's predecessor
;; Numeric.
(define-public python2-numpy-1.8
- (package (inherit python2-numpy)
+ (package
+ (inherit python2-numpy)
(version "1.8.2")
(source
(origin
(method git-fetch)
(uri (git-reference
- (url "https://github.com/numpy/numpy")
- (commit (string-append "v" version))))
+ (url "https://github.com/numpy/numpy")
+ (commit (string-append "v" version))))
(file-name (git-file-name "numpy" version))
(sha256
(base32
"0ikgi15rsqwbkfsjjxrwh40lqyal2wvyp3923y6w6ch3dcr82sfk"))))
- (arguments
- (substitute-keyword-arguments (package-arguments python2-numpy)
- ((#:phases phases)
- `(modify-phases ,phases
- (replace 'configure-blas
- (lambda* (#:key inputs #:allow-other-keys)
- (call-with-output-file "site.cfg"
- (lambda (port)
- (format port
- "[openblas]
-libraries = openblas
-library_dirs = ~a/lib
-include_dirs = ~a/include
-"
- (assoc-ref inputs "openblas")
- (assoc-ref inputs "openblas"))))))))))
- (native-inputs
- (list python2-nose))
+ (arguments (substitute-keyword-arguments (package-arguments python2-numpy)
+ ((#:tests? _ #f) #f) ;disable tests
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (delete 'delete-failing-tests)))))
+ (native-inputs '())
(description "NumPy is the fundamental package for scientific computing
with Python. It contains among other things: a powerful N-dimensional array
object, sophisticated (broadcasting) functions, tools for integrating C/C++
- 07/242: gnu: python-traitlets: Update to 5.1.1., (continued)
- 07/242: gnu: python-traitlets: Update to 5.1.1., guix-commits, 2022/05/12
- 39/242: gnu: Add python-jaraco-functools-bootstrap., guix-commits, 2022/05/12
- 60/242: gnu: python-factory-boy: Update to 3.2.1., guix-commits, 2022/05/12
- 133/242: gnu: python-websockets: Update to 10.3 and enable tests., guix-commits, 2022/05/12
- 132/242: gnu: python-ipython-documentation: Also build info and pdf targets., guix-commits, 2022/05/12
- 124/242: gnu: texlive-fontspec: Add missing propagated inputs., guix-commits, 2022/05/12
- 147/242: gnu: Add python-pecan., guix-commits, 2022/05/12
- 149/242: gnu: python-fakeredis: Update to 1.7.1., guix-commits, 2022/05/12
- 152/242: gnu: Add python-openapi-core., guix-commits, 2022/05/12
- 153/242: gnu: Add python-jupyterlab-server., guix-commits, 2022/05/12
- 155/242: gnu: python-numpy: Update to 1.21.6 and parallelize build/tests.,
guix-commits <=
- 158/242: gnu: python-pandas: Build and run tests in parallel., guix-commits, 2022/05/12
- 163/242: gnu: python-jupyter-server: Update to 1.16.0., guix-commits, 2022/05/12
- 159/242: gnu: python-pandas: Update to 1.4.2., guix-commits, 2022/05/12
- 166/242: gnu: python-sparqlkernel: Use gexps and fix inputs., guix-commits, 2022/05/12
- 169/242: gnu: xeus: Update to 2.4.1., guix-commits, 2022/05/12
- 173/242: gnu: mbed-tools: Update to 7.53.0 and relax click version requirement., guix-commits, 2022/05/12
- 184/242: gnu: sshoot: Update to 1.5.1., guix-commits, 2022/05/12
- 182/242: gnu: python-bitstruct: Update to 8.14.0., guix-commits, 2022/05/12
- 181/242: gnu: Add python-argparse-addons., guix-commits, 2022/05/12
- 196/242: gnu: python-miio: Update to 0.5.11., guix-commits, 2022/05/12