Discussion:
[Qgis-user] No module named qgis.core
Radosław Pasiok
2009-01-21 15:04:21 UTC
Permalink
Hello list!

I'm using qgis 1.0.0-4 from _OSGeo4W_ and have difficulties running
from qgis.core import *
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from qgis.core import *
ImportError: No module named qgis.core

Tried many different paths in PATH and PYTHONPATH without succes. Can
someone point to the right places? Everything is installed in default
path C:\OSGeo4W.
Thank you!

--
Radek
Jürgen E. Fischer
2009-01-21 17:07:23 UTC
Permalink
Hi Radek,
Post by Radosław Pasiok
I'm using qgis 1.0.0-4 from _OSGeo4W_ and have difficulties running
from qgis.core import *
File "<pyshell#0>", line 1, in <module>
from qgis.core import *
ImportError: No module named qgis.core
hm, this is getting annoying. That's the same problem as with some
grass modules.

Every DLL and/or EXE loaded from a path not being
%OSGEO4W_ROOT%\bin, which is depending on ssleay32.dll and/or
libeay32.dll won't work, when you have a different version of those two
DLLS in %WINDIR%\system32. For example this affects everything that is
using GDAL16.DLL, which depends on LIBCURL.DLL, which in turn depends on
the 2 DLLs.

AFAIK Windows searches the directory the DLL (or pyd in this case) was
loaded from first, then system32 and after that everything that is in
PATH.

So the solution is to either update the DLLs in system32. I'm not sure
if that might break other things, which might be depending on the
current version. Frank Warmerdam is currently looking into this.

Or you can copy the 2 DLLs to every directory where affected DLLs/EXEs
live. In this case %OSGEO4W_ROOT%\apps\Python25\lib\site-packages\qgis
But that's obviously just a workaround.


J?rgen
--
J?rgen E. Fischer norBIT GmbH Tel. +49-4931-918175-20
Dipl.-Inf. (FH) Rheinstra?e 13 Fax. +49-4931-918175-50
Software Engineer D-26506 Norden http://www.norbit.de
--
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502
Radosław Pasiok
2009-01-22 08:56:59 UTC
Permalink
Jurgen,

thank you very much for explanations and instructions!
import qgis.core
For those who may be interested, I added %OSGEO4W_ROOT%\bin to PATH
variable and set PYTHONPATH to
%OSGEO4W_ROOT%\apps\Python25\lib\site-packages\

Radek
Pacius
2009-02-13 17:38:11 UTC
Permalink
Post by Radosław Pasiok
Jurgen,
thank you very much for explanations and instructions!
import qgis.core
For those who may be interested, I added %OSGEO4W_ROOT%\bin to PATH
variable and set PYTHONPATH to
%OSGEO4W_ROOT%\apps\Python25\lib\site-packages\
Radek
Hi.

I have the same problem and I copied ssleay32.dll and libeay32.dll in
%WINDIR%\system32 but that did not help. I am using Windows Vista x64 and
installed everything from osgeo4w-setup.exe (as download).

My paths are as below.

set PATH=C:\OSGeo4W\apps\qgis\lib;%PATH%

set PATH=c:\OSGeo4W\apps\qgis;%PATH%

set PATH=c:\OSGeo4W\bin;%PATH%

set PYTHONPATH=c:\OSGeo4W\apps\Python25\lib\site-packages\

SET PYTHONHOME=c:\OSGeo4W\bin\

This is what I get:

python Python_qgis.py

'import site' failed; use -v for traceback
Traceback (most recent call last):
File "Python_qgis.py", line 1, in <module>
from qgis.core import *
ImportError: No module named qgis.core

-Pac
--
View this message in context: http://n2.nabble.com/No-module-named-qgis.core-tp2192255p2322189.html
Sent from the qgis-user mailing list archive at Nabble.com.
Pacius
2009-02-15 18:25:33 UTC
Permalink
Post by Pacius
Hi.
I have the same problem and I copied ssleay32.dll and libeay32.dll in
%WINDIR%\system32 but that did not help. I am using Windows Vista x64 and
installed everything from osgeo4w-setup.exe (as download).
-Pac
Found out that Python 2.5.2 (which comes with osgeo4w) does not work with
64bit Vista, you have to use at least Python 2.6 (or 2.6.1), I do not
recommend Python 3.x because it is not backward compatible with previous
releases.

-Pac
--
View this message in context: http://n2.nabble.com/No-module-named-qgis.core-tp2192255p2330564.html
Sent from the qgis-user mailing list archive at Nabble.com.
Loading...