2

I have got a lot problems with the configuration of Eclipse with PyDev in order to develop QGIS plugins. The situation is very weird and frustrating. I can import qgis module using Pyscripter without any problems but in the case of Eclipse I have already spend a few hours to find out solution. I check a lot of tutorials from the Internet but I have not get answer to my question yet. This is not a duplicate question because I have checked all solutions form other questions. In my case I have got ArcGIS 10.2 and QGIS 2.2 installed on my machine.

I use the script below to run PyScripter

@echo off call "%~dp0\o4w_env.bat" call "%OSGEO4W_ROOT%"\apps\grass\grass-6.4.3\etc\env.bat @echo off path %OSGEO4W_ROOT%\apps\qgis\bin;%OSGEO4W_ROOT%\apps\grass\grass-6.4.3\lib;%PATH% set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis set GDAL_FILENAME_IS_UTF8=YES rem Set VSI cache to be used as buffer, see #6448 set VSI_CACHE=TRUE set VSI_CACHE_SIZE=1000000 set PYTHONPATH=C:\OSGeo4W\apps\qgis\python Set PATH=C:\OSGeo4W\apps\qgis\bin;%PATH% set QGISHOME=C:\OSGeo4W\apps\qgis\ Start c:\PROGRA~2\PyScripter\pyscripter.exe --python27 --pythondllpath=C:\OSGeo4W\bin 

In that case I can import qgis or qgis.core without any problems.

When I check paths using :

import sys for item in sys.path: print item 

I get this result:

C:\OSGeo4W\apps\qgis\python C:\OSGeo4W\bin\python27.zip C:\OSGeo4W\apps\Python27\DLLs C:\OSGeo4W\apps\Python27\lib C:\OSGeo4W\apps\Python27\lib\plat-win C:\OSGeo4W\apps\Python27\lib\lib-tk C:\OSGeo4W\apps\Python27 C:\OSGeo4W\apps\Python27\lib\site-packages C:\OSGeo4W\apps\Python27\lib\site-packages\PIL C:\OSGeo4W\apps\Python27\lib\site-packages\win32 C:\OSGeo4W\apps\Python27\lib\site-packages\win32\lib C:\OSGeo4W\apps\Python27\lib\site-packages\Pythonwin C:\OSGeo4W\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win32.egg C:\OSGeo4W\apps\Python27\lib\site-packages\wx-2.8-msw-unicode 

As the results I get ready working with QGIS Pyscripter but using this software I can not debug my plugin.

In the case of Eclipse I use this bat file

@echo off SET OSGEO4W_ROOT=c:\OSGeo4W call "%OSGEO4W_ROOT%"\bin\o4w_env.bat call "%OSGEO4W_ROOT%"\apps\grass\grass-6.4.3\etc\env.bat @echo off SET GDAL_DRIVER_PATH=%OSGEO4W_ROOT%\bin\gdalplugins path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin;%OSGEO4W_ROOT%\apps\grass\grass-6.4.3\lib set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python; set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\Python27\Lib\site-packages set QGIS_PREFIX_PATH=%OSGEO4W_ROOT%\apps\qgis "C:\Progra~2\eclipse\eclipse.exe" 

When I use piece of code mentioned above to check paths I get:

C:\Python27\ArcGIS10.2\lib\site-packages\setuptools-2.2-py2.7.egg C:\Python27\ArcGIS10.2\lib\site-packages\sphinx-1.2.1-py2.7.egg C:\Python27\ArcGIS10.2\lib\site-packages\jinja2-2.7.2-py2.7.egg C:\Python27\ArcGIS10.2\lib\site-packages\docutils-0.11-py2.7.egg C:\Python27\ArcGIS10.2\lib\site-packages\pygments-1.6-py2.7.egg C:\Python27\ArcGIS10.2\lib\site-packages\markupsafe-0.18-py2.7.egg c:\OSGeo4W\apps\qgis\python c:\OSGeo4W\apps\Python27\Lib\site-packages c:\OSGeo4W\apps\Python27\DLLs c:\OSGeo4W\apps\Python27\lib c:\OSGeo4W\apps\Python27\lib\lib-tk C:\OSGeo4W\bin c:\OSGeo4W\apps\Python27 c:\OSGeo4W\apps\Python27\lib\site-packages\PIL c:\OSGeo4W\apps\Python27\lib\site-packages\win32 c:\OSGeo4W\apps\Python27\lib\site-packages\win32\lib c:\OSGeo4W\apps\Python27\lib\site-packages\Pythonwin c:\OSGeo4W\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win32.egg c:\OSGeo4W\apps\Python27\lib\site-packages\wx-2.8-msw-unicode C:\OSGeo4W\bin\python27.zip C:\Python27\ArcGIS10.2\Lib C:\Python27\ArcGIS10.2\DLLs C:\Python27\ArcGIS10.2\Lib\lib-tk C:\Python27\ArcGIS10.2 C:\Python27\ArcGIS10.2\lib\site-packages C:\Program Files (x86)\ArcGIS\Desktop10.2\bin C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy C:\Program Files (x86)\ArcGIS\Desktop10.2\ArcToolbox\Scripts 

Of course I set Forced Builtins for qgis and PyQt4 but still It does not work.

When I try to run import qgis I get this error and I get error

from qgis.core import QgsFeature, QgsGeometry ImportError: DLL load failed The specified module could not be found. 

Any idea how to solve this problem?

1
  • This is Rajesh I whave a doubt form QGIS 2.2 version in my system can't enable to install in new plugins, It will showing red color . Is there any option form in my system please tel me as soon as possible. !enter image description here Commented May 12, 2014 at 10:51

2 Answers 2

1

You have to configure a new interpreter. The python selected for the interpreter should be the OSGeo4w Python, not the system Python. For any given Pydev project you pick which interpreter to use. That way ArcPy and OSGeo Python are never together in the path.

Just update, the paths and versions to match. http://lists.osgeo.org/pipermail/qgis-developer/2010-February/009182.html

Follow up info. http://www.qgis.org/en/docs/pyqgis_developer_cookbook/ide_debugging.html

0

I have tried to use the batch file to set the eclipse before and it did not work. Probably I have received the same error message as you.

Later, I tried to set the path & pythonhome directly in the eclipse interpreter environment setting. And it works for me.

PATH: C:\OSGeo4W\bin;C:\OSGeo4W\apps\qgis\bin

PYTHONPATH: C:\OSGeo4W\apps\python27

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.