Thursday 27 October 2016

pyqgis - QGIS start-up error message: "Couldn't load plugin MetaSearch due to an error when calling its classFactory() method"


I'm an Ubuntu 16.04 (64-bit) user and I just recently upgraded my QGIS instalation (from 2.14, "Essen", to 2.16, "Nødebo").


I'm not a programmer and I know little about the details of how python works, much less about how QGIS and python relate, so when I get this message at start-up, I don't really know what to do about it:


Couldn't load plugin MetaSearch due to an error when calling its classFactory() method 


ImportError: No module named requests
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 333, in startPlugin
plugins[packageName] = package.classFactory(iface)
File "/home/jmb/.qgis2/python/plugins/MetaSearch/__init__.py", line 29, in classFactory
from MetaSearch.plugin import MetaSearchPlugin
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/jmb/.qgis2/python/plugins/MetaSearch/plugin.py", line 31, in

from MetaSearch.dialogs.maindialog import MetaSearchDialog
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/jmb/.qgis2/python/plugins/MetaSearch/dialogs/maindialog.py", line 44, in
from owslib.csw import CatalogueServiceWeb
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/usr/share/qgis/python/owslib/csw.py", line 27, in
from owslib.util import OrderedDict
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import

mod = _builtin_import(name, globals, locals, fromlist, level)
File "/usr/share/qgis/python/owslib/util.py", line 35, in
import requests
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named requests


Python version: 2.7.11+ (default, Apr 17 2016, 14:00:29) [GCC 5.3.1 20160413]
QGIS version: 2.16.1-Nødebo Nødebo, 8545b3b


Python Path:
/usr/share/qgis/python
/home/jmb/.qgis2/python
/home/jmb/.qgis2/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old

/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
/home/jmb/.qgis2//python


Note that I can ignore this message and work in QGIS without further issues.




Anyways, can anyone tell me how to fix this?




In case it matters, here are the commands used for upgrading QGIS:


sudo apt-get update
sudo apt install qgis python-qgis qgis-plugin-grass

And these are the lines in my relevant lines from the /etc/apt/sources.list file:


deb http://qgis.org/debian xenial main
deb-src http://qgis.org/debian xenial main





Note2: can this be originated by the non ASCII character in the QGIS version "Nødebo"?




Answer



Had the same error, found the solution here: QGIS issues


Just run:


sudo pip install requests

to install the required module.



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...