dtaidistance
Distance measures for time series (Dynamic Time Warping, fast C implementation)
Decision gist · record as of 2026-08-14
Yes. dtaidistance is actively maintained, has no known vulnerabilities, and offers a well-tested implementation of DTW with both accessibility (pure Python) and performance (C with OpenMP). The Apache-2.0 license is permissive. Install friction is moderate due to C compilation, but pre-built wheels for Python 3.11–3.14 on major platforms mitigate this. Suitable for time series analysis, clustering, and similarity tasks.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires numpy at runtime; C implementation benefits from OpenMP but falls back to pure Python if unavailable.
- Medium install friction due to C compilation, but pre-built wheels cover modern Python versions (3.11–3.14) and major platforms.
- Last release was 183 days ago with active repository maintenance and 1241 stars.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions.
last release 2026-02-12 (183 days) · last repo commit 2026-07-07 · 1,241 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 138,728 downloads/mo, #11,319 on PyPI
Alternatives
Verify before relying
pip install dtaidistance
from dtaidistance import dtw
import numpy as np
s1 = np.array([0.0, 0, 1, 2, 1, 0, 1, 0, 0])
s2 = np.array([0.0, 1, 2, 0, 0, 0, 0, 0, 0])
d = dtw.distance_fast(s1, s2)- Whether the C implementation is automatically selected or requires explicit configuration on all platforms.
- Performance scaling characteristics for very large time series or high-dimensional data.
- Compatibility with recent versions of scipy for clustering workflows mentioned in the description.
What it is and what it does
dtaidistance is a library for computing distance measures between time series, centered on Dynamic Time Warping (DTW) and related algorithms. It offers a pure Python implementation and a fast C implementation (with Cython as the build-time dependency). The library is designed to work seamlessly with NumPy and Pandas while avoiding unnecessary data copies.
The package supports a range of DTW variants and optimizations: windowed alignment, pruning strategies, multi-dimensional sequences, barycenter averaging for clustering, and subsequence search. It can compute distances between pairs of series, full distance matrices across sets of series, or partial blocks for distributed computation. The C implementation includes parallelization via OpenMP when available.
Use it for
- Measure similarity between sensor time series or financial price sequences to detect anomalies or patterns.
- Build distance matrices for time series clustering using hierarchical or other clustering methods.
- Align and compare sequences of different lengths in speech recognition, gesture analysis, or bioinformatics.
- Accelerate large-scale time series comparisons using the fast C backend with optional pruning.
- Compute warping paths and visualize alignment between two time series for exploratory analysis.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
dtaidistance is actively maintained, has no known vulnerabilities, and offers a well-tested implementation of DTW with both accessibility (pure Python) and performance (C with OpenMP). The Apache-2.0 license is permissive. Install friction is moderate due to C compilation, but pre-built wheels for Python 3.11–3.14 on major platforms mitigate this. Suitable for time series analysis, clustering, and similarity tasks.
Install
dtaidistance on PyPI
Before you install
Medium install friction due to C compilation, but pre-built wheels cover modern Python versions (3.11–3.14) and major platforms. Last release was 183 days ago with active repository maintenance and 1241 stars.
Requires numpy at runtime; C implementation benefits from OpenMP but falls back to pure Python if unavailable.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
pip install dtaidistance
from dtaidistance import dtw
import numpy as np
s1 = np.array([0.0, 0, 1, 2, 1, 0, 1, 0, 0])
s2 = np.array([0.0, 1, 2, 0, 0, 0, 0, 0, 0])
d = dtw.distance_fast(s1, s2)
Verify before relying
- Whether the C implementation is automatically selected or requires explicit configuration on all platforms.
- Performance scaling characteristics for very large time series or high-dimensional data.
- Compatibility with recent versions of scipy for clustering workflows mentioned in the description.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packagenumpy |
| Maintenance | Actively maintained 183 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 138,728 / month, #11,319 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 3 |
Evidence: dtaidistance-2.4.0-cp311-cp311-macosx_10_9_universal2.whl; dtaidistance-2.4.0-cp311-cp311-macosx_15_0_arm64.whl; dtaidistance-2.4.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; dtaidistance-2.4.0-cp311-cp311-win_amd64.whl; dtaidistance-2.4.0-cp312-cp312-macosx_10_13_universal2.whl; dtaidistance-2.4.0-cp312-cp312-macosx_11_0_arm64.whl; dtaidistance-2.4.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; dtaidistance-2.4.0-cp312-cp312-win_amd64.whl; dtaidistance-2.4.0-cp313-cp313-macosx_10_13_universal2.whl; dtaidistance-2.4.0-cp313-cp313-macosx_15_0_arm64.whl; dtaidistance-2.4.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; dtaidistance-2.4.0-cp313-cp313-win_amd64.whl; dtaidistance-2.4.0-cp314-cp314-macosx_10_15_universal2.whl; dtaidistance-2.4.0-cp314-cp314-macosx_26_0_arm64.whl; dtaidistance-2.4.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; dtaidistance-2.4.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; dtaidistance-2.4.0-cp314-cp314-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “dynamic time warping distance”
- dtaidistanceComputes distance measures between time series using Dynamic Time…
- dtw-pythonComputes Dynamic Time Warping alignments between time series,…
- fastdtwfastdtw computes approximate Dynamic Time Warping (DTW) alignments…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also dtw-python · fastdtw · tslearn · stumpy · Distance · strsimpy · textdistance · pylcs · fastcluster · simdkalman