[GIS] Can’t Import Python Module in QGIS

errorinstallationpyqgisqgis

I'm trying to import the dateutil.rrule module in the python console of QGIS. That package is installed in my system, i can import it in the python2 console, but inside QGIS i get this error:

from dateutil.rrule import rrule
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/share/qgis/python/qgis/utils.py", line 607, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named rrule

I also have this problem with dateutil.easter and dateutil.zoneinfo.

I don't have it with dateutil.parser, datetime.tz and dateutil.relativedelta module

I'm using QGIS 2.18, python 2.7.12, python2-dateutil 2.5.3-1 in archilinux up to date.

Best Answer

I've figured out the reason, qgis installed a stripped down version of the dateutil library in the folder /usr/share/qgis/python/dateutil who lacked the rrule, easter and zoneinfo modules. Once i removed that folder, qgis reads the one installed by the system in /usr/lib/python2.7/site-packages/dateutil which is complete.

Related Question