How to fix ModuleNotFoundError: No module named 'dateutil'
Problem:
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 "my.py", 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
Solution
The package is named python-dateutil
. Install using
sudo pip install python-dateutil
or (for Python3)
sudo pip3 install python-dateutil