How to Install pytz in Python
World timezone definitions, modern and historical
pip install pytz
What is pytz?
World timezone definitions, modern and historical
pytz - World Timezone Definitions for Python
pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher. It also solves the issue of ambiguous times at the end of daylight saving time, which you can read more about in the Python Library Reference (``).
Almost all of the Olson timezones are supported.
Quick Start
Minimal example to get started with pytz:
import pytz
print(pytz.__version__)
Installation
pip (standard)
pip install pytz
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install pytz
pip3
pip3 install pytz
conda
conda install -c conda-forge pytz
Poetry
poetry add pytz
Verify the Installation
After installing, confirm the package is available:
python -c "import pytz; print(pytz.__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 pytz with pip.
ModuleNotFoundError: No module named 'pytz'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install pytz. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'pytz' (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 pytz to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'pytz'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show pytz and upgrade with pip install --upgrade pytz.
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 pytz. 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 pytz
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 pytz
Recent Releases
| Version | Released |
|---|---|
2026.1 |
2026-03-03 |
2026.1.post1 latest |
2026-03-03 |
2025.2 |
2025-03-25 |
2025.1 |
2025-01-31 |
2024.2 |
2024-09-11 |
Manage pytz
Upgrade to latest version
pip install --upgrade pytz
Install a specific version
pip install pytz==2026.1.post1
Uninstall
pip uninstall pytz
Check what is installed
pip show pytz