How to Install python-dateutil in Python
Extensions to the standard Python datetime module
pip install python-dateutil
What is python-dateutil?
Extensions to the standard Python datetime module
dateutil - powerful extensions to datetime
The module provides powerful extensions to the standard module, available in Python.
can be installed from PyPI using (note that the package name is different from the importable name)::
Quick Start
Minimal example to get started with python-dateutil:
import dateutil
print(dateutil.__version__)
Installation
pip (standard)
pip install python-dateutil
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install python-dateutil
pip3
pip3 install python-dateutil
conda
conda install -c conda-forge python-dateutil
Poetry
poetry add python-dateutil
Dependencies
Installing python-dateutil will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import dateutil; print(dateutil.__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 python-dateutil with pip.
ModuleNotFoundError: No module named 'dateutil'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install python-dateutil. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'dateutil' (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 python-dateutil to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'dateutil'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show python-dateutil and upgrade with pip install --upgrade python-dateutil.
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 python-dateutil. 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 python-dateutil
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 python-dateutil
Recent Releases
| Version | Released |
|---|---|
2.9.0 |
2024-03-01 |
2.9.0.post0 latest |
2024-03-01 |
2.8.2 |
2021-07-14 |
2.8.1 |
2019-11-03 |
2.8.0 |
2019-02-05 |
Manage python-dateutil
Upgrade to latest version
pip install --upgrade python-dateutil
Install a specific version
pip install python-dateutil==2.9.0.post0
Uninstall
pip uninstall python-dateutil
Check what is installed
pip show python-dateutil