Registry / devops / tenacity

tenacity

JSON →
library9.1.4pypypi✓ verified 25d ago

Tenacity is a general-purpose retrying library for Python, designed to simplify adding retry behavior to functions. The current version is 9.1.4, released on February 7, 2026. It follows a regular release cadence, with recent updates addressing Python 3.14 support and improvements to retry annotations. ([pypi.org](https://pypi.org/project/tenacity/?utm_source=openai))

pip install tenacity
INSTALL
IMPORT
SIG · TENACITY
T
tenacity
devopspythonv9.1.4
Install
1.6s avg
Import
75ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v9.1.4 · 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
installs and imports cleanly · install 0.0s · import 0.080s · 18MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.070s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

retry
from tenacity import retry
Ensure 'retry' is imported from 'tenacity' to utilize its retrying capabilities.

A simple example demonstrating the use of Tenacity to retry a function that may raise an IOError.

import random from tenacity import retry @retry def do_something_unreliable(): if random.randint(0, 10) > 1: raise IOError('Broken sauce, everything is hosed!!!111one') else: return 'Awesome sauce!' print(do_something_unreliable())
Debug
Known issues
breakingTenacity is a fork of the 'retrying' library and is not API compatible with it.
fix
Update code to use Tenacity's API.
affects: All
gotchaEnsure 'retry' is imported from 'tenacity' to utilize its retrying capabilities.
fix
Use 'from tenacity import retry' in your imports.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tenacity'
The 'tenacity' library has not been installed in the current Python environment.
fix
pip install tenacity
NameError: name 'retry' is not defined
The 'retry' decorator was used in the code without being imported from the 'tenacity' library.
fix
Add 'from tenacity import retry' at the top of your Python file.
TypeError: 'int' object is not callable
The 'wait' or 'stop' parameters of the 'retry' decorator were provided with a non-callable value like an integer, instead of a 'tenacity' helper function.
fix
Use tenacity helper functions such as 'wait_fixed(N)' or 'stop_after_attempt(N)' for the 'wait' and 'stop' parameters, e.g., '@retry(wait=wait_fixed(2))'.
TypeError: retry() got an unexpected keyword argument 'max_attempts'
The 'retry' decorator does not accept a direct 'max_attempts' argument; the maximum number of attempts is configured using the 'stop' parameter.
fix
Replace 'max_attempts=N' with 'stop=stop_after_attempt(N)' to specify the desired maximum number of attempts.
Upgrade
Version history
9.1.4latest on PyPI · released Feb 7, 2026
Audit
Dependencies
retryingrequiredTenacity is a fork of the 'retrying' library, offering enhanced functionality and fixes.
Agent activity
58 hits · last 30 days
node
51
Amazon
1
OpenAI (training)
1
Resources
tenacity — pip install tenacity · libregistry