Opened 3 years ago
Closed 3 years ago
#722 closed defect (duplicate)
Python Path Environment not correctly set on fresh install
Reported by: | Wolfgang Meinolf | Owned by: | |
---|---|---|---|
Priority: | major | Component: | Package |
Version: | 1.0 | Keywords: | Installer Win10 |
Cc: |
Description
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.
duplicate of #718