How to Install humanize in Python
Python humanize utilities
pip install humanize
What is humanize?
Python humanize utilities
This modest package contains various common humanization utilities, like turning a number into a fuzzy human-readable duration ("3 minutes ago") or into a human-readable size or throughput. It is localized to:
- Arabic - Basque - Bengali - Brazilian Portuguese - Catalan - Danish - Dutch - Esperanto - European Portuguese - Finnish - French - German - Greek - Hebrew - Indonesian - Italian - Japanese - Klingon - Korean - Norwegian - Persian - Polish - Russian - Simplified Chinese - Slovak - Slovenian - Spanish - Swedish - Turkish - Ukrainian - Uzbek - Vietnamese
If seconds are too large, set to milliseconds or microseconds:
Quick Start
Minimal example to get started with humanize:
import humanize
from datetime import datetime, timedelta
print(humanize.intcomma(1234567)) # 1,234,567
print(humanize.naturalsize(1048576)) # 1.0 MB
past = datetime.now() - timedelta(minutes=5)
print(humanize.naturaltime(past)) # 5 minutes ago
Installation
pip (standard)
pip install humanize
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install humanize
pip3
pip3 install humanize
conda
conda install -c conda-forge humanize
Poetry
poetry add humanize
Verify the Installation
After installing, confirm the package is available:
python -c "import humanize; print(humanize.__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 humanize with pip.
ModuleNotFoundError: No module named 'humanize'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install humanize. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'humanize' (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 humanize to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'humanize'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show humanize and upgrade with pip install --upgrade humanize.
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 humanize. 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 humanize
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 humanize
Recent Releases
| Version | Released |
|---|---|
4.15.0 latest |
2025-12-20 |
4.14.0 |
2025-10-15 |
4.13.0 |
2025-08-25 |
4.12.3 |
2025-04-30 |
4.12.2 |
2025-03-24 |
Manage humanize
Upgrade to latest version
pip install --upgrade humanize
Install a specific version
pip install humanize==4.15.0
Uninstall
pip uninstall humanize
Check what is installed
pip show humanize