0

i have bought the book "building mapping applications with qgis" from eric westra.

Currently i'm following the steps described in the book. But at the verry first trial of an external app i get an error.

Traceback (most recent call last):
  File "C:\OSGeo4w64\apps\qgis\python\qgis\__init__.py", line 26, in <module>
    import sip
ImportError: No module named sip

I found several sip folders in my "osgeo4w64" folder.

further more i used the advanced osgeo installer?

as variables i setup:

osgeo4w_root = C:\OSGeo4w64
path = C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Condusiv Technologies\ExpressCache\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\PFPS\system;C:\Program Files\SIMDIS\bin\amd64-nt;C:\Program Files (x86)\Boundless\OpenGeo\jetty\jre\bin;C:\Program Files (x86)\Boundless\OpenGeo\bin;C:\Program Files (x86)\Boundless\OpenGeo\sdk\bin;C:\Program Files (x86)\Boundless\OpenGeo\pgsql\bin;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\FME\;c:\OSGeo4w64\apps\qgis\bin
pythonpath = C:\OSGeo4W64\apps\qgis\python
qgis_prefix = c:\OSGeo4w64\apps\qgis

as you can see the whole list at path has already multiple path's.

  • Problem solved. I made sure of an clean and proper install of both, qgis and python. furthermore the variables are aperantly not enough settings. I found the solution in an other question on this question/site. – BearHunt Dec 8 '15 at 23:52
1

This is the batch file the problem will solve. I open this batch file every time. The programs created are only functioning when opened from/by the python shell opened by this batch file.

REM Change OSGeo4W_ROOT to point to your install of QGIS.

SET OSGEO4W_ROOT=C:\OSGeo4W64
SET QGISNAME=qgis
SET QGIS=%OSGEO4W_ROOT%\apps\%QGISNAME%
set QGIS_PREFIX_PATH=%QGIS%

CALL "%OSGEO4W_ROOT%\bin\o4w_env.bat"

: Python Setup
set PATH=%OSGEO4W_ROOT%\bin;%QGIS%\bin;%PATH%
SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27
set PYTHONPATH=%QGIS%\python;%PYTHONPATH%

ECHO OSGeo path is: %OSGEO4W_ROOT%
ECHO Getting QGIS libs from: %QGIS%
ECHO Python loaded from: %PYTHONHOME%

C:\Python27\python.exe

many thanks to "Nathan W"

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.