How to Install itsdangerous in Python
Safely pass data to untrusted environments and back.
pip install itsdangerous
What is itsdangerous?
Safely pass data to untrusted environments and back.
Various helpers to pass data to untrusted environments and to get it back safe and sound. Data is cryptographically signed to ensure that a token has not been tampered with.
It's possible to customize how data is serialized. Data is compressed as needed. A timestamp can be added and verified automatically while loading a token.
Here's how you could generate a token for transmitting a user's id and name between web requests.
Quick Start
Minimal example to get started with itsdangerous:
import itsdangerous
print(itsdangerous.__version__)
Installation
pip (standard)
pip install itsdangerous
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install itsdangerous
pip3
pip3 install itsdangerous
conda
conda install -c conda-forge itsdangerous
Poetry
poetry add itsdangerous
Verify the Installation
After installing, confirm the package is available:
python -c "import itsdangerous; print(itsdangerous.__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 itsdangerous with pip.
ModuleNotFoundError: No module named 'itsdangerous'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install itsdangerous. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'itsdangerous' (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 itsdangerous to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'itsdangerous'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show itsdangerous and upgrade with pip install --upgrade itsdangerous.
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 itsdangerous. 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 itsdangerous
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 itsdangerous
Recent Releases
| Version | Released |
|---|---|
2.2.0 latest |
2024-04-16 |
2.1.2 |
2022-03-24 |
2.1.1 |
2022-03-09 |
2.1.0 |
2022-02-18 |
2.0.1 |
2021-05-18 |
Manage itsdangerous
Upgrade to latest version
pip install --upgrade itsdangerous
Install a specific version
pip install itsdangerous==2.2.0
Uninstall
pip uninstall itsdangerous
Check what is installed
pip show itsdangerous