[GIS] ”No module named ogr” when installing QGIS plugins

ogrqgisqgis-2.6qgis-cloudqgis-plugins

In QGIS 2.6.1, when I try to install the FlowMapper and QGIS Cloud plugins, I get an error – "The plugin is broken. Python said: no module named ogr" – giving me the only option of removing them. Other plugins work fine.

Because of this, when I open 2.6.1, this message comes up:

Nu s-a putut încărca pluginul FlowMapper datorită unei erori în timpul apelării metodei classFactory()


Traceback (most recent call last):
  File "C:/PROGRA~1/QGISBR~1/apps/qgis/./python\qgis\utils.py", line 208, in startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:/Users/Cezar/.qgis2/python/plugins\FlowMapper\__init__.py", line 24, in classFactory
    from flowmapper import FlowMapper
  File "C:/PROGRA~1/QGISBR~1/apps/qgis/./python\qgis\utils.py", line 460, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Users/Cezar/.qgis2/python/plugins\FlowMapper\flowmapper.py", line 24, in 
    import ogr
  File "C:/PROGRA~1/QGISBR~1/apps/qgis/./python\qgis\utils.py", line 460, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named ogr


Versiune Python:
2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]


Versiune QGIS:
2.6.1-Brighton Brighton, e2a51df

Cale Python: ['C:/PROGRA~1/QGISBR~1/apps/qgis/./python', u'C:/Users/Cezar/.qgis2
/python', u'C:/Users/Cezar/.qgis2/python/plugins', 'C:/PROGRA~1/QGISBR~1/apps/qgis
/./python/plugins', 'C:\\PROGRA~1\\QGISBR~1\\bin\\python27.zip', 'C:\\PROGRA~1
\\QGISBR~1\\apps\\Python27\\DLLs', 'C:\\PROGRA~1\\QGISBR~1\\apps\\Python27\\lib', 
'C:\\PROGRA~1\\QGISBR~1\\apps\\Python27\\lib\\plat-win', 'C:\\PROGRA~1\\QGISBR~1\\apps
\\Python27\\lib\\lib-tk', 'C:\\PROGRA~1\\QGISBR~1\\bin', 'C:\\PROGRA~1\\QGISBR~1\\apps
\\Python27', 'C:\\PROGRA~1\\QGISBR~1\\apps\\Python27\\lib\\site-packages', 
'C:\\PROGRA~1\\QGISBR~1\\apps\\Python27\\lib\\site-packages\\PIL', 'C:\\PROGRA~1
\\QGISBR~1\\apps\\Python27\\lib\\site-packages\\jinja2-2.7.2-py2.7.egg', 'C:\\PROGRA~1
\\QGISBR~1\\apps\\Python27\\lib\\site-packages\\markupsafe-0.23-py2.7-win32.egg', 
'C:\\PROGRA~1\\QGISBR~1\\apps\\Python27\\lib\\site-packages\\python_dateutil-
2.2-py2.7.egg', 'C:\\PROGRA~1\\QGISBR~1\\apps\\Python27\\lib\\site-packages\\pytz-
2014.2-py2.7.egg', 'C:\\PROGRA~1\\QGISBR~1\\apps\\Python27\\lib\\site-packages
\\win32', 'C:\\PROGRA~1\\QGISBR~1\\apps\\Python27\\lib\\site-packages\\win32\\lib', 
'C:\\PROGRA~1\\QGISBR~1\\apps\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\PROGRA~1
\\QGISBR~1\\apps\\Python27\\lib\\site-packages\\Shapely-1.2.18-py2.7-win32.egg', 
'C:\\PROGRA~1\\QGISBR~1\\apps\\Python27\\lib\\site-packages\\six-1.6.1-py2.7.egg', 
'C:\\PROGRA~1\\QGISBR~1\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', 
'C:\\Users\\Cezar\\.qgis2\\python\\plugins\\DigitizingTools\\tools']    

Before this version, I used QGIS 2.4, which I forgot to delete, so I still have it. I tested the plugins there and they work very well.
Are the plugins incompatible with version 2.6.1, or is there another problem?

Best Answer

Resolved! It's a module PATH Python console problem.

In QGIS Brighton/apps/Python27/Lib/site-packages create osgeo.pth (Administrators) file and put

# .pth file for the osgeo extensions osgeo

start QGIS and install flowmapper ;)

Clarifying, after create osgeo.pth file, open him and just add in first line the word osgeo, save and run QGIS! Done.

Related Question