Registry / data / ruptures

ruptures

JSON →
library1.1.10pypypi✓ verified 23d ago

ruptures is a Python library for off-line change point detection. This package provides methods for the analysis and segmentation of non-stationary signals. It is actively maintained with regular minor releases, and the current stable version is 1.1.10.

pip install ruptures
INSTALL
IMPORT
SIG · RUPTURES
R
ruptures
datapythonv1.1.10
Install
7.5s avg
Import
2840ms
Disk
231MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.10 · 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
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 7.5s · import 2.840s · 227MB
231MB installed
● package 231MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ruptures
import ruptures as rpt
Standard import alias for the library.
Pelt
from ruptures.detection import Pelt
Alternatively, access via the main alias: `rpt.Pelt`.
CostL2
from ruptures.costs import CostL2
Alternatively, access via the main alias: `rpt.CostL2`.

This example generates a piecewise constant signal with noise, then applies the Pelt algorithm with an L2 cost function to detect change points. Finally, it visualizes the original signal, true change points, and detected change points.

import ruptures as rpt import numpy as np import matplotlib.pyplot as plt # Generate a signal with change points n_samples, n_dims, sigma = 500, 3, 2 n_bkps = 3 # number of breakpoints signal, bkps = rpt.pw_constant(n_samples, n_dims, n_bkps, noise_std=sigma, seed=42) # Change point detection with Pelt algorithm and L2 cost algo = rpt.Pelt(model="l2", jump=1, min_size=1).fit(signal) result = algo.predict(pen=10) # Display results fig, ax_array = rpt.display(signal, bkps, result) plt.show()
Debug
Known issues
gotchaPrior to v1.1.8 (for `CostRbf`) and v1.1.7 (for `CostL2`, `Binseg`), the `min_size` parameter in certain cost functions and search methods might have been incorrectly handled. This could lead to errors or unexpected segmentations when `min_size` was set to 1.
fix
Upgrade to ruptures v1.1.8 or later to ensure correct behavior, especially for `min_size=1`.
affects: <1.1.8
gotchaVersions prior to v1.1.6 had a bug affecting the random behavior of `KernelCPD` (particularly with the Pelt method), which could lead to non-reproducible results when using random states.
fix
For reproducible results, upgrade to ruptures v1.1.6 or newer and ensure a random seed is set when generating data or initializing algorithms if randomness is involved.
affects: <1.1.6
gotchaA memory leak was identified and fixed in `KernelCPD` in versions prior to v1.1.2, which could cause performance degradation or crashes during long-running tasks or with large datasets.
fix
Users experiencing memory-related issues with `KernelCPD` should update to ruptures v1.1.2 or later.
affects: <1.1.2
gotchaBefore v1.1.4, the `costar` function did not always enforce `deepcopy` of input data, which could lead to unintended in-place modifications of the original data when using this cost function.
fix
Upgrade to ruptures v1.1.4 or later to prevent unexpected side effects from in-place modifications when using `costar`.
affects: <1.1.4
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'ruptures'
The 'ruptures' library is not installed in your current Python environment.
fix
Install the library using pip: `pip install ruptures`
ValueError: The number of breakpoints must be positive.
The 'n_bkps' parameter, which specifies the number of change points, was set to a non-positive integer (0 or negative).
fix
Set `n_bkps` to an integer greater than 0, or use `n_bkps=None` for algorithms like Pelt that automatically select the number of change points.
```python
import ruptures as rpt
import numpy as np
signal = np.random.rand(100)
algo = rpt.Pelt(model="l2", n_bkps=None) # Correct
# Or: algo = rpt.Binseg(model="l2", n_bkps=1) # Correct, if a specific positive number is desired
```
TypeError: fit() missing 1 required positional argument: 'signal'
The `fit` method of the change point detection algorithm was called without providing the input data array (`signal`) to be analyzed.
fix
Pass the input data array (e.g., a NumPy array) as the `signal` argument to the `fit` method.
```python
import ruptures as rpt
import numpy as np
signal = np.random.rand(100, 1)
algo = rpt.Pelt(model="l2")
algo.fit(signal) # Correct
```
FutureWarning: 'algo' is deprecated and will be removed in version 1.2. Use 'model' instead.
The deprecated `algo` parameter was used when initializing a change point detection algorithm; it has been renamed to `model`.
fix
Replace the `algo` parameter with `model` in the algorithm's constructor.
```python
import ruptures as rpt
# Incorrect: algo = rpt.Pelt(algo="l2")
algo = rpt.Pelt(model="l2") # Correct
```
Upgrade
Version history
1.1.10latest on PyPI · released Sep 10, 2025
Audit
Dependencies
numpyrequiredRequired for numerical operations.
scipyrequiredRequired for scientific computing functions.
matplotliboptionalOptional, for displaying signals and change points.
nltkoptionalOptional, required for text segmentation examples.
Agent activity
9 hits · last 30 days
node
6
OpenAI (training)
1
Resources
ruptures — pip install ruptures · libregistry