Install & Compatibility
Where this runs
tested against v1.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.318s · 230.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 7.4s · import 1.294s · 222MB
229MB installed
● package 229MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
similaritymeasures
✓ import similaritymeasures
Import the module itself; functions are accessed as similaritymeasures.frechet_dist(...)
Frechet distance function
✓ similaritymeasures.frechet_dist
✗ frechet_dist
frechet_dist is not a top-level import; must be accessed via the module
Demonstrates basic usage of main similarity measures
import numpy as np
import similaritymeasures
# Define two curves as arrays of (x, y) points
p = np.array([[1, 1], [2, 1], [3, 2]])
q = np.array([[1, 1], [2, 3], [3, 2]])
# Discrete Frechet distance
frechet = similaritymeasures.frechet_dist(p, q)
print(f"Frechet distance: {frechet}")
# Dynamic time warping (DTW)
dtw, d = similaritymeasures.dtw(p, q)
print(f"DTW distance: {dtw}")
# Area between two curves
area = similaritymeasures.area_between_two_curves(p, q)
print(f"Area between curves: {area}")
# Curve length measure
clm = similaritymeasures.curve_length_measure(p, q)
print(f"Curve length measure: {clm}")
Errors
Common errors & fixes
ImportError: cannot import name 'frechet_dist' from 'similaritymeasures'
Attempting to import the function directly instead of the module.
fixUse `import similaritymeasures` then `similaritymeasures.frechet_dist(...)`.
ValueError: operands could not be broadcast together with shapes
Input curves have different number of points and not compatible for element-wise operations (e.g., `area_between_two_curves` requires equal lengths).
fixEnsure both curves have the same number of points, or use DTW which can handle different lengths.
TypeError: only size-1 arrays can be converted to Python scalars
Passing a list or tuple that isn't converted to numpy array, or ragged arrays.
fixConvert your curves to numpy arrays: `p = np.array(p)` and `q = np.array(q)`.
Upgrade
Version history
1.4.0latest on PyPI · released Oct 18, 2025
Audit
Dependencies
numpyrequiredRequired for all numerical operations
scipyrequiredRequired for Frechet distance (scipy.spatial.distance.cdist) and DTW