[R-pkg-team] Bug#1094704: r-cran-fastcluster: FTBFS with numpy 2.x: tests failed

s3v c0llapsed at yahoo.it
Tue Feb 4 13:06:58 GMT 2025


Dear Maintainer,

After Build-Depending on dh-sequence-numpy, I get this error during build:

[...]
======================================================================
ERROR: test_nan (tests.fastcluster_test.test_nan)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/r-cran-fastcluster-1.2.6/.pybuild/cpython3_3.13_fastcluster/build/tests/__init__.py", line 10, in test_nan
    test()
    ~~~~^^
  File "/build/r-cran-fastcluster-1.2.6/.pybuild/cpython3_3.13_fastcluster/build/tests/nantest.py", line 49, in test
    fastcluster.linkage([np.inf,-np.inf,-np.inf], method=method)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/build/r-cran-fastcluster-1.2.6/.pybuild/cpython3_3.13_fastcluster/build/fastcluster.py", line 230, in linkage
    X = array(X, copy=False, subok=True)
ValueError: Unable to avoid copy while creating an array as requested.
If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x).
For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.

======================================================================
ERROR: test_vector (tests.fastcluster_test.test_vector)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/r-cran-fastcluster-1.2.6/.pybuild/cpython3_3.13_fastcluster/build/tests/__init__.py", line 14, in test_vector
    test(10)
    ~~~~^^^^
  File "/build/r-cran-fastcluster-1.2.6/.pybuild/cpython3_3.13_fastcluster/build/tests/vectortest.py", line 236, in test
    test_all(n,dim)
    ~~~~~~~~^^^^^^^
  File "/build/r-cran-fastcluster-1.2.6/.pybuild/cpython3_3.13_fastcluster/build/tests/vectortest.py", line 106, in test_all
    Z2 = fc.linkage_vector(pcd, method, metric)
  File "/build/r-cran-fastcluster-1.2.6/.pybuild/cpython3_3.13_fastcluster/build/fastcluster.py", line 467, in linkage_vector
    X = array(X, dtype=dtype, copy=False, order='C', subok=True)
ValueError: Unable to avoid copy while creating an array as requested.
If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x).
For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.

----------------------------------------------------------------------
Ran 3 tests in 2.920s

FAILED (errors=2)

[...]

There is an issue opened upstream at https://github.com/fastcluster/fastcluster/issues/93.
Attached patch makes r-cran-fastcluster build again.

Kind Regards.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: numpy2.patch
Type: text/x-patch
Size: 2214 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/r-pkg-team/attachments/20250204/2483584b/attachment.bin>


More information about the R-pkg-team mailing list