I am a QGIS developer. We have been modifying the source code of QGIS for several months and have done good work in QGIS version 2.1. After that we tried to do the same modifications for QGIS version 2.5. A lot of code had to be modified, but we managed to build it. However, we encountered a problem in python, which is this:

Couldn't load PyQGIS.
Python support will be disabled.
Traceback (most recent call last):
  File "", line 1, in 
  File "D:/qgis/build/x86/qgis2.5.0/./python\qgis\__init__.py", line 36, in 
    from qgis.core import QgsFeature, QgsGeometry
  File "D:/qgis/build/x86/qgis2.5.0/./python\qgis\core\__init__.py", line 1, in 
    from qgis._core import *
ImportError: dynamic module does not define init function (init_core)
Python version:
2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]
QGIS version:
2.5.0-Master 'Master', exported

I have looked up this error and found that it may be related to PYTHONPATH or PATH environment variables. I tried all possible values for both environmental variables without success.

I am working on a 64-bit Windows 7, and the QGIS build is 32 bit.

  • I have the same problem, but this is happening in linux, from the repository build. – sovemp Aug 14 '14 at 3:37

Reading an answer at this thread, I found that the suggestion

Can you touch python/core/core.sip or start with a clean build dir?

Sometimes an error happens when building the python bindings and when compiling again the build system spuriously assumes that python bindings have been built correctly and skips rebuilding them despite them not actually being built.

where the touch command should be performed from the source directory root (it should update timestamp of an existing file, not create a new one!). For Windows equivalent of this command see this SuperUser question. Following the suggestion helped me proceed past this error while building QGIS from source.

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.