[Osgeo4w-trac] [osgeo4w] #725: Python Path Environment not correctly set on fresh install

OSGeo4W trac_osgeo4w at osgeo.org
Fri Jan 21 00:35:03 PST 2022


#725: Python Path Environment not correctly set on fresh install
-----------------------------+-----------------------------
Reporter:  Wolfgang Meinolf  |      Owner:  osgeo4w-dev@…
    Type:  defect            |     Status:  new
Priority:  major             |  Component:  Package
 Version:  1.0               |   Keywords:  Installer Win10
-----------------------------+-----------------------------
 **What is the bug or the crash?**

 On a new PC we installed QGIS using OSGeo4W Installer and found, that some
 processing scripts did not load. Same worked fine on former installations
 end 2021. Missing processing scripts use geopandas. During tests we found,
 that installed geopandas lib cannot be imported.

 **Steps to reproduce the issue:**

 (1) Install QGIS using OSGeo4W Installer with admin rights, easy install
 and select QGIS, Grass and Saga.
 \\
 (2) Start installer again and add python libs rtree and geopandas.
 Confirm, to also install dependent packages, which include fiona.
 \\
 (3) Start QGIS
 \\
 (4) Start pyqgis Console
 \\
 (5) Enter "import geopandas", first error ist displayed
 \\
 (6) Enter "import geopandas" again, different error ist displayed

 **Message in QGIS PY console:**

 # Python-Konsole
 # Verwende iface für den Zugriff auf die QGIS API-Schnittstelle oder
 help(iface) für weitere Informationen
 # Sicherheitswarnung: Die Eingabe von Befehlen aus einer nicht
 vertrauenswürdigen Quelle kann den Computer beschädigen
 import geopandas
 Traceback (most recent call last):
   File "C:\OSGeo4W\apps\Python39\lib\code.py", line 90, in runcode
     exec(code, self.locals)
   File "<input>", line 1, in <module>
   File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
     mod = _builtin_import(name, globals, locals, fromlist, level)
   File "C:\OSGeo4W\apps\Python39\lib\site-packages\geopandas\__init__.py",
 line 7, in <module>
     from geopandas.io.file import _read_file as read_file  # noqa
   File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
     mod = _builtin_import(name, globals, locals, fromlist, level)
   File "C:\OSGeo4W\apps\Python39\lib\site-packages\geopandas\io\file.py",
 line 7, in <module>
     import fiona
   File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
     mod = _builtin_import(name, globals, locals, fromlist, level)
   File "C:\OSGeo4W\apps\Python39\lib\site-packages\fiona\__init__.py",
 line 86, in <module>
     from fiona.collection import BytesCollection, Collection
   File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
     mod = _builtin_import(name, globals, locals, fromlist, level)
   File "C:\OSGeo4W\apps\Python39\lib\site-packages\fiona\collection.py",
 line 11, in <module>
     from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
   File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
     mod = _builtin_import(name, globals, locals, fromlist, level)
 ImportError: DLL load failed while importing ogrext: Das angegebene Modul
 wurde nicht gefunden.

 ==
 **Workaround after some investigation:**

 Execute manually the python-qgis.bat located in OSGeo4W\bin folder. Close
 window with exit().

 Alternatively also "set
 PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python;%PYTHONPATH%" entered in
 OSGeo4W Shell seems to help.

-- 
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/725>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.


More information about the Osgeo4w-trac mailing list