-
Notifications
You must be signed in to change notification settings - Fork 541
Open
Labels
Description
Describe the bug
Test of pot 0.9.5 with scipy 1.17.0 are failing, evidently due to use of a deprecated API.
A failing test log from debian CI testing can be found at
https://ci.debian.net/packages/p/python-pot/unstable/amd64/68899094/
To Reproduce
- install scipy 1.17
pytest-3 -v test/test_utils.py -k test_dist
157s =================================== FAILURES ===================================
157s __________________________________ test_dist ___________________________________
157s
157s def test_dist():
157s n = 10
157s
157s rng = np.random.RandomState(0)
157s x = rng.randn(n, 2)
157s
157s D = np.zeros((n, n))
157s for i in range(n):
157s for j in range(n):
157s D[i, j] = np.sum(np.square(x[i, :] - x[j, :]))
157s
157s D2 = ot.dist(x, x)
157s D3 = ot.dist(x)
157s
157s D4 = ot.dist(x, x, metric="minkowski", p=2)
157s
157s assert D4[0, 1] == D4[1, 0]
157s
157s # dist shoul return squared euclidean
157s np.testing.assert_allclose(D, D2, atol=1e-14)
157s np.testing.assert_allclose(D, D3, atol=1e-14)
157s
157s # tests that every metric runs correctly
157s metrics_w = [
157s "braycurtis",
157s "canberra",
157s "chebyshev",
157s "cityblock",
157s "correlation",
157s "cosine",
157s "dice",
157s "euclidean",
157s "hamming",
157s "jaccard",
157s "matching",
157s "minkowski",
157s "rogerstanimoto",
157s "russellrao",
157s "sokalmichener",
157s "sokalsneath",
157s "sqeuclidean",
157s "yule",
157s ] # those that support weights
157s metrics = [
157s "mahalanobis",
157s "seuclidean",
157s ] # do not support weights depending on scipy's version
157s
157s for metric in metrics_w:
157s print(metric)
157s > ot.dist(x, x, metric=metric, p=3, w=rng.random((2,)))
157s
157s test/test_utils.py:220:
157s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
157s /usr/lib/python3/dist-packages/ot/utils.py:340: in dist
157s return cdist(x1, x2, metric=metric, w=w)
157s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
157s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
157s
...
157s else:
157s > raise ValueError(f'Unknown Distance Metric: {mstr}')
157s E ValueError: Unknown Distance Metric: sokalmichener
157s
157s /usr/lib/python3/dist-packages/scipy/spatial/distance.py:2936: ValueError
...
157s =========================== short test summary info ============================
157s FAILED test/test_utils.py::test_dist - ValueError: Unknown Distance Metric: s...
157s = 1 failed, 931 passed, 70 skipped, 4 xfailed, 4000 warnings in 61.35s (0:01:01) =
Code sample
https://github.com/PythonOT/POT/blob/master/test/test_utils.py
Expected behavior
test_utils.py::test_dist should pass.
Environment (please complete the following information):
- OS Linux (debian)
- Python version: 3.13
- How was POT installed: debian
apt-get install python3-pot python3-scipy/experimental
Output of the following code snippet:
import platform; print(platform.platform())
import sys; print("Python", sys.version)
import numpy; print("NumPy", numpy.__version__)
import scipy; print("SciPy", scipy.__version__)
import ot; print("POT", ot.__version__)Linux-6.18.9+deb14-amd64-x86_64-with-glibc2.42
Python 3.13.12 (main, Feb 4 2026, 15:06:39) [GCC 15.2.0]
NumPy 2.3.5
SciPy 1.17.0
POT 0.9.5
Reactions are currently unavailable