Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is my first question so please go easy. I am trying to develop a Plugin for QGIS. I made my plugin using the "plugin builder", then compiled the .qrc and .ui files with PySide-rcc.exe and respectively. This all seems satisfactory.

However, my first problem arises when the plugin loads as the QGIS and Python (PySide) libraries are not in the same place.

ImportError: No module named PySide

I resolved this by adding a reference to the PySide path at the start of the compiled .ui module:

Import sys

Unfortunately when I run it again I get the critical error:

ImportError: DLL load failed: %1 is not a valid Win32 application.

Google searches are leading me to believe that this is caused by an incompatibility between 32bit and 64bit modules, however, I cannot easily download different versions as they are supplied under my companies IS policy.

This seems to apply to all the QGIS modules as i can not access any modules even from the python console:

>>> import sys
>>> sys.path.append("C:/Program Files (x86)/Quantum GIS Lisboa/apps/qgis/python")
>>> for path in sys.path:
print path

C:/Program Files (x86)/Quantum GIS Lisboa/apps/qgis/python
>>> from qgis.core import QgsFeatures

Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
from qgis.core import QgsFeatures
ImportError: DLL load failed: %1 is not a valid Win32 application.

Has anyone else experienced this problem or is there an obvious issue that i have not noticed?



Running: Windows 7 (64bit), Python 2.7.2 (64bit), QGIS 1.8.0 (???)

share|improve this question
actually this i have noticed that this happens in the console as described above, which is 64bit. But that when it happens in QGIS the python being used is 32bit - presumably QGIS is also 32bit. – Christopher Lloyd Brett Jul 24 '13 at 13:35
Urgh, Ok, i now see that my company have issued me with 64bit Python and modules and 32bit QGIS with 32bit Python and modules. Seemingly there is a compatibility between the modules available to each as running the from qgis.core import QgsFeatures in the QGIS python console yeilds no problems - however, i still need to build my ui and qrc files. Time to lobby the IT department for 32bit PySide installed into the QGIS module directory. – Christopher Lloyd Brett Jul 24 '13 at 13:46
You shouldn't be using pyside or your own Python install. QGIS comes with it's own Python27 install and PyQt4 which has pyucc4 – Nathan W Jul 24 '13 at 21:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.