Registry / ai-ml / pyannote-core

pyannote-core

JSON →
library6.0.1pypypi✓ verified 26d ago

pyannote.core is an open-source Python library providing advanced data structures for handling temporal segments with attached labels. It serves as the foundational component for the broader pyannote ecosystem, which includes libraries for parsing, metrics, databases, audio, and video processing. The library facilitates the manipulation and visualization of temporal data, especially useful in speech processing and diarization tasks. The current version is 6.0.1, part of an actively developed project with a history of significant updates and breaking changes between major releases.

pip install pyannote-core
INSTALL
IMPORT
SIG · PYANNOTE-CORE
P
pyannote-core
ai-mlpythonv6.0.1
Install
11.1s avg
Import
1974ms
Disk
318MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.0.1 · 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.910 runs
installs and imports cleanly · install 0.0s · import 2.052s · 315.4MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 11.1s · import 1.896s · 304MB
318MB installed
● package 318MB
Code
Verified usage

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

Segment
from pyannote.core import Segment
Timeline
from pyannote.core import Timeline
Annotation
from pyannote.core import Annotation
SlidingWindow
from pyannote.core import SlidingWindow
SlidingWindowFeature
from pyannote.core import SlidingWindowFeature

This quickstart demonstrates the creation and basic manipulation of the core data structures: Segment, Timeline, and Annotation. It shows how to define temporal intervals, combine them into an ordered set, and attach labels to segments.

from pyannote.core import Segment, Timeline, Annotation # 1. Create a Segment (start, end) s1 = Segment(0.0, 10.0) s2 = Segment(12.5, 15.0) print(f"Segment 1: {s1}") print(f"Duration of s1: {s1.duration:.1f}s\n") # 2. Create a Timeline (ordered set of non-empty segments) timeline = Timeline([s1, s2, Segment(1.0, 5.0)], uri="meeting_audio") print(f"Initial Timeline: {timeline}") timeline = timeline.support() print(f"Unified Timeline support: {timeline}\n") # 3. Create an Annotation (segments with attached labels/tracks) annotation = Annotation(uri="meeting_audio") annotation[Segment(0.5, 3.0)] = "Speaker_A" annotation[Segment(2.0, 4.5)] = "Speaker_B" annotation[Segment(5.0, 7.0), "music"] = "Background_Music" print(f"Annotation labels: {annotation.labels()}") print(f"Annotation timeline for Speaker_A: {annotation.label_timeline('Speaker_A')}")
Debug
Known issues
breakingVersion 6.0.0 introduced breaking changes, including dropping support for Python versions older than 3.10 and switching to a native namespace package structure. Ensure your environment meets the new Python requirement and update import mechanisms if relying on non-standard package structures.
fix
Upgrade Python to 3.10 or newer. Check `pyproject.toml` or official documentation for precise import paths, especially if upgrading from very old versions.
affects: >=6.0.0
breakingThe `pyannote.core.Scores` class and related functionalities were removed in version 3.3. If your code depends on `pyannote.core.Scores` for handling scores over time, you will need to refactor it, potentially using `pyannote.core.SlidingWindowFeature` or custom data structures.
fix
Migrate away from `pyannote.core.Scores`. Consult `pyannote.core` documentation for alternative approaches to score representation, such as `SlidingWindowFeature`.
affects: >=3.3, confirmed for 6.x compatibility
breakingAs of version 4.4, `Timeline.__init__` no longer accepts empty segments (where `start >= end`). Additionally, `Timeline.extent()` now returns `Segment(0.0, 0.0)` for empty timelines, affecting how edge cases for empty data are handled.
fix
Ensure all segments passed to `Timeline` constructors are non-empty. Update logic that checks the extent of potentially empty timelines to expect `Segment(0.0, 0.0)`.
affects: >=4.4
gotchaFloating-point precision issues can lead to inconsistencies when comparing `Segment` instances. It is highly recommended to call `Segment.set_precision(ndigits)` once after importing `pyannote.core.Segment` to globally round start and end timestamps to a consistent precision.
fix
Add `Segment.set_precision(ndigits)` (e.g., `Segment.set_precision(5)`) early in your script or module after importing `Segment`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyannote.core'
The `pyannote.core` library or its dependencies are not correctly installed or not accessible in the Python environment where the code is being run. This often happens due to a missing installation or an incorrect virtual environment activation.
fix
Ensure `pyannote.core` is installed in your active environment: `pip install pyannote.core` or `conda install -c conda-forge pyannote.core`.
TypeError: entry_points() got an unexpected keyword argument 'group'
This error typically occurs when an older version of `setuptools` or `importlib_metadata` (often a dependency of `pyannote` ecosystem libraries) is used with a newer Python version (e.g., Python 3.9+), where the `entry_points` API changed, causing a compatibility issue.
fix
Upgrade `setuptools` and `importlib_metadata` (if applicable) to their latest versions, or ensure a compatible Python version is used. `pip install --upgrade setuptools importlib_metadata` (or `pip install --upgrade setuptools` as `importlib_metadata` might be part of the standard library in newer Python versions).
AttributeError: 'NoneType' object has no attribute 'items'
This error often arises when using `pyannote.audio` (which builds upon `pyannote.core`) to create an `Annotation` object, but the underlying model (e.g., from Hugging Face) fails to load (e.g., due to a missing or invalid authentication token), causing the pipeline to return `None` instead of a `pyannote.core.Annotation` instance.
fix
Ensure you have accepted the terms of the Hugging Face model and provided a valid authentication token (e.g., `HUGGINGFACE_ACCESS_TOKEN` environment variable or passed directly to `Pipeline.from_pretrained`). Verify the model loads correctly before attempting operations on the output.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. pyannote-core 6.0.1 requires numpy>=2.0, but you have numpy 1.26.0 which is incompatible.
This is a direct dependency conflict where the installed `numpy` version does not meet the minimum requirement of `pyannote-core` (version 6.0.1 requires `numpy>=2.0`). This usually happens when other packages pin `numpy` to an older version.
fix
Upgrade `numpy` to a compatible version, ideally `numpy>=2.0` or a more recent version like `numpy>=2.3` as suggested in related issues for the `pyannote` ecosystem. `pip install --upgrade "numpy>=2.3"`.
Upgrade
Version history
6.0.1latest on PyPI · released Sep 16, 2025
Audit
Dependencies
numpyrequiredFundamental array manipulation.
pandasrequiredData manipulation and DataFrame integration.
sortedcontainersrequiredEfficient sorted container implementations.
ipythonoptionalFor rich display in Jupyter notebooks.
matplotliboptionalFor plotting and visualization in notebooks.
Agent activity
14 hits · last 30 days
node
10
Bingbot
1
OpenAI (training)
1
Resources
pyannote-core — pip install pyannote-core · libregistry