How to fix ModuleNotFoundError: No module named ‘dateutil’


You want to use the dateutil library in Python, but when you try to import it, you see an exception like this:

Traceback (most recent call last):
  File "", line 11, in <module>
    import dateutil as dl
ModuleNotFoundError: No module named 'dateutil'

When you try installing it using e.g. pip install dateutil you see this error message:

Collecting dateutil
  Could not find a version that satisfies the requirement dateutil (from versions: )
No matching distribution found for dateutil


The package is named python-dateutil. Install using

sudo pip install python-dateutil

or (for Python3)

sudo pip3 install python-dateutil