Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python error: ImportError: cannot import name connection #3

Open
lorex82 opened this issue Feb 29, 2016 · 7 comments
Open

Python error: ImportError: cannot import name connection #3

lorex82 opened this issue Feb 29, 2016 · 7 comments

Comments

@lorex82
Copy link

lorex82 commented Feb 29, 2016

Python error at the installation on ubuntu 14.04 (32 and 64 bit) with qgis 2.8.6, 2.12, and 2.14 (after installe flickr api).

flickr2qgis_error

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

ImportError: cannot import name connection
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 306, in startPlugin
plugins[packageName] = package.classFactory(iface)
File "/home/lorex/.qgis2/python/plugins/flickr2qgis/init.py", line 34, in classFactory
from .flickr2qgis import flickr2qgis
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/lorex/.qgis2/python/plugins/flickr2qgis/flickr2qgis.py", line 33, in
import flickrapi
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/flickrapi/init.py", line 52, in
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/flickrapi/core.py", line 13, in
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/flickrapi/tokencache.py", line 10, in
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/flickrapi/auth.py", line 23, in
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/requests_toolbelt/init.py", line 12, in
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/requests_toolbelt/adapters/init.py", line 12, in
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/requests_toolbelt/adapters/ssl.py", line 16, in
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/requests_toolbelt/_compat.py", line 22, in
ImportError: cannot import name connection

Python version: 2.7.6 (default, Jun 22 2015, 18:01:27) [GCC 4.8.2]
QGIS version: 2.14.0-Essen Essen, exported

Python Path:
/home/lorex/.qgis2/python/plugins/processing
/usr/share/qgis/python
/home/lorex/.qgis2/python
/home/lorex/.qgis2/python/plugins
/usr/share/qgis/python/plugins
/usr/local/lib/python2.7/dist-packages/flickrapi-2.1.2-py2.7.egg
/usr/local/lib/python2.7/dist-packages/requests_toolbelt-0.6.0-py2.7.egg
/usr/local/lib/python2.7/dist-packages/requests_oauthlib-0.6.1-py2.7.egg
/usr/local/lib/python2.7/dist-packages/oauthlib-1.0.3-py2.7.egg
/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/gst-0.10
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/pymodules/python2.7
/usr/lib/python2.7/dist-packages/ubuntu-sso-client
/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode
/home/lorex/.qgis2//python
/usr/share/qgis/python/plugins/fTools/tools

@riccardoklinger
Copy link
Contributor

please open the python command tool and try
import flickrapi
what is the result?

@lorex82
Copy link
Author

lorex82 commented Feb 29, 2016

Python Console
Use iface to access QGIS API interface or Type help(iface) for more info
import flickrapi
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/flickrapi/init.py", line 52, in

File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/flickrapi/core.py", line 13, in

File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/flickrapi/tokencache.py", line 10, in

File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/flickrapi/auth.py", line 23, in

File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/requests_toolbelt/init.py", line
12, in
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
File
"build/bdist.linux-x86_64/egg/requests_toolbelt/adapters/init.py", line
12, in
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/requests_toolbelt/adapters/ssl.py",
line 16, in
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "build/bdist.linux-x86_64/egg/requests_toolbelt/_compat.py", line
22, in
ImportError: cannot import name connection

Thanks,
Lorenzo

2016-02-29 12:51 GMT+01:00 Riccardo Klinger [email protected]:

please open the python command tool and try
import flickrapi
what is the result?


Reply to this email directly or view it on GitHub
#3 (comment)
.

@lorex82
Copy link
Author

lorex82 commented Feb 29, 2016

The problem is only with ubuntu. on Debian 8 qgis 2.14 and fedora 23 qgis 2.10, plugin work fine.

@riccardoklinger
Copy link
Contributor

Hi Lorenzo. This seems to be not a problem related to the flickr2qgis plugin. It seems like flickrapi is not installed correctly on your Ubuntu system(s).
With typing:
import flickrapi
you test the functionality of importing a module into qgis. this is independent from the plugin.

@riccardoklinger
Copy link
Contributor

I've now the same problem. installed flickrapi and tried to import it in a normal python environment without the QGIS "overhead".
I've created an issue for flickrapi:
https://bitbucket.org/sybren/flickrapi/issues/64/cannot-import-flickrapi

@riccardoklinger
Copy link
Contributor

on Ubuntu I solved this issue with

sudo pip install --upgrade pip
sudo pip install requests --upgrade

@lorex82 can you try it as well?

@lorex82
Copy link
Author

lorex82 commented Mar 8, 2016

Perfect! Now ubuntu 14.04 it's ok!
I just added this command
apt-get install python-pip
Thank you!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants