I am trying to separate two overlapping vector layers and find out the difference in QGIS 2.18. I have tried finding difference with layers with points and also with buffers. Both of them give following error:

global name 'QgsWKBTypes' is not defined See log for more details

I have searched the web for this but can't seem to find a solution.


This problem was already fixed in the source code, see the reported issue.

You have mainly 3 solutions:

Mid term solution

According to the road map, QGIS 2.18.1 will be released in 25.11.2016, you'll get the fix with such version. Simply wait 22 days for it, OK?


This is free software, so you can get the fix instantly!

Short term solutions

  1. Install a nightly build. Check what packages are available for your operating system here.

  2. Edit the file yourself.

    If you're on GNU/Linux, go to /usr/share/qgis/python/plugins/processing/algs/qgis/Difference.py (on Windows it will be C:\Program Files\QGIS 2.18\apps\qgis\python\plugins\processing\algs\qgis\Difference.py), and make sure line 32 looks like this:

    from qgis.core import QGis, QgsFeatureRequest, QgsFeature, QgsGeometry, QgsWKBTypes 

    If you don't want to edit the file, you can just replace it, downloading the fixed file from here (right click on the link and select Save Link As...).

    You will need administrator privileges to either edit or replace the file. After this, restart QGIS.

  • my Difference.py file looks like you write, but it didn't work anyway( – Jane Jun 13 '18 at 12:42

other solution - Try Difference from SAGA vector polygon tools - it works!

enter image description here

protected by Community Dec 27 '16 at 21:45

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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