I'm running QGIS 2.14 and trying to learn how to develop python standalone scripts. Currently I am using Canopy's (v distribution of Python 2.7. My development is on a Mac (OS 10.13.1) and I have set my PYTHONPATH to /Applications/Qgis.app/Contents/Resources/python. When I type in

from qgis.core import * 

I get the following error trace:

ImportErrorTraceback (most recent call last)`
<ipython-input-8-f6129d8bb24b> in <module>()`
----> 1 from qgis.core import *

/Applications/QGis.app/Contents/Resources/python/qgis/__init__.py in <module>()
     34     pass
---> 36 from qgis.core import QgsFeature, QgsGeometry

/Applications/QGis.app/Contents/Resources/python/qgis/core/__init__.py in <module>()
     33 import string
     34 from qgis._core import *
---> 35 from PyQt4.QtCore import QCoreApplication

/Users/babsii/Library/Enthought/Canopy/edm/envs/User/lib/python2.7/site-packages/IPython/external/qt_loaders.py in load_module(self, fullname)
     54     Importing %s disabled by IPython, which has
     55     already imported an Incompatible QT Binding: %s
---> 56     """ % (fullname, loaded_api()))
     58 ID = ImportDenier()

   Importing PyQt4 disabled by IPython, which has
   already imported an Incompatible QT Binding: pyside 

I see if I run a non-Enthought/Canopy distribution, I don't have this issue. Is there a way to still use the Enthought/Canopy distribution?

Your Answer

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

Browse other questions tagged or ask your own question.