Python cannot find dateutil.relativedelta
I had a similar issue but for a simpler reason. My fresh virtualenv simply didn't have dateutil installed and I didn't know the Python package name. I tried pip install dateutil
, which obviously didn't work since the package name was incorrect. Running pip install python-dateutil
instead worked (without resorting to sudo
).
This looks like a problem of package installation to me. A troubleshooting list that comes to my mind:
- Verify you installed the package.
- If installed, verify that the files have been stored in the right directory (a directory accessible from your python interpreter (= in the PYTHONPATH, useful article here).
- Verify permission on those files.
- Restart your shell if you tried the import there.
- Reboot your computer (ouch... it's 10 years since I started using GNU/Linux, but I still suffer from the bad memories of Windows! ;)
I also ran into this issue. The simple solution I ended up using was to add --upgrade
to the end of the command. This forced it to install it even though Python thought it was installed. This resolved the issue.
So if you have this issue, try the following:
sudo pip install python-dateutil --upgrade
It can't possibly hurt anything, so there is no harm in just forcing it to be reinstalled.