After installing the latest QGIS version for Mac (2.18.0), geoprocessing tools such as "Difference" and "Symmetrical Difference" are no longer working. Instead, the log window shows the following error message:

2016-11-14T14:28:43 2 Uncaught error while executing algorithm Traceback (most recent call last): File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/core/GeoAlgorithm.py", line 203, in execute self.processAlgorithm(progress) File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/qgis/Difference.py", line 71, in processAlgorithm geomType = QgsWKBTypes.multiType(QGis.fromOldWkbType(layerA.wkbType())) NameError: global name 'QgsWKBTypes' is not defined

Does anyone have an idea what the problem might be and how to fix it?

marked as duplicate by Germán Carrillo, Andre Silva, Mapperz Jan 5 '17 at 15:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Did you send to trash QGIS old version before installing V.2.18.0? – aldo_tapia Nov 14 '16 at 13:50
  • Yes I completely removed the old version – guyus Nov 16 '16 at 7:49

This was a bug in 2.18.0 which has been fixed meanwhile. Wait for 2.18.1.

Or install qgis2 from homebrew with the --devel switch.

  • OK, thanks for the info! In that case I'll just wait for the new release. – guyus Nov 16 '16 at 7:50
  • By the way, for python errors in plugins it's always better to directly open a bug report (plugins all have a link to a bug_tracker in the plugin manager) - after checking if the same problem has not been reported before. – Matthias Kuhn Nov 16 '16 at 7:58

This issue was not resolved with 2.18 release - it is specific to the "difference" function. You can add the following to line 32 of the difference.py file, which for me was located at C:\Program Files\QGIS 2.18\apps\qgis\python\plugins\processing\algs\qgis:

from qgis.core import:

  • QGis

  • QgsFeatureRequest

  • QgsFeature

  • QgsGeometry

  • QgsWKBTypes

Adding the QgsWKBTypes import allowed me to utilize the difference function.

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