How to Install retry in Python
Easy to use retry decorator.
pip install retry
What is retry?
Easy to use retry decorator.
- No external dependency (stdlib only). - (Optionally) Preserve function signatures (). - Original traceback, easy to debug.
def retry(exceptions=Exception, tries=-1, delay=0, maxdelay=None, backoff=1, jitter=0, logger=logginglogger): """Return a retry decorator.
fixed if a number, random if a range tuple (min, max)
Quick Start
Minimal example to get started with retry:
import retry
print(retry.__version__)
Installation
pip (standard)
pip install retry
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install retry
pip3
pip3 install retry
conda
conda install -c conda-forge retry
Poetry
poetry add retry
Dependencies
Installing retry will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import retry; print(retry.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing retry with pip.
ModuleNotFoundError: No module named 'retry'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install retry. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'retry' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install retry to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'retry'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show retry and upgrade with pip install --upgrade retry.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install retry. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user retry
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org retry
Recent Releases
| Version | Released |
|---|---|
0.9.2 latest |
2016-05-11 |
0.9.1 |
2015-07-03 |
0.9.0 |
2015-04-27 |
0.9.0.dev83 |
2015-04-26 |
0.7.0 |
2015-03-11 |
Manage retry
Upgrade to latest version
pip install --upgrade retry
Install a specific version
pip install retry==0.9.2
Uninstall
pip uninstall retry
Check what is installed
pip show retry