7

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"?

  • 1
    please check in the issue list hub.qgis.org/issues/15368 btw as you can see the message is "No module named requests" – Luigi Pirelli Aug 10 '16 at 7:03
  • Indeed, but I didn't really know what to do about that. – Juan Aug 10 '16 at 14:10
  • Don't just blindly let Python install stuff on your system, i.e., as root. Check first if your package manager provides the module in question, so that you get the benefits of proper dependency tracking. Doesn't apply if you're on Windows, I guess. – user85223 Oct 27 '16 at 0:58
8

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

Just run:

sudo pip install requests

to install the required module.

| improve this answer | |
4

In my case this helped (Ubuntu 16.04):

sudo apt-get install python-requests
| improve this answer | |
0

Download the (experimental) version from http://plugins.qgis.org/plugins/ Then install the Plugin via plugins > manage and install plugins > install from zip > your zip file

| improve this answer | |
-1

go to C:\Users\your computer account \.qgis2\python\plugins and delete all recent files (sort by recent date), especially .pyc files.

| improve this answer | |
  • ALL? you just deleted all plugins. – JGH Sep 8 '17 at 19:06
  • Anybody find a simple command line fix for this ongoing (at least 2 year researching on QGIS bug reports) issue? Thanks. – lewis May 19 '18 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.