#766 closed defect (worksforme)
starting qgis from OSGeo4W shell: Couldn't load plugin 'processing'
Reported by: | jakimowb | Owned by: | |
---|---|---|---|
Priority: | major | Component: | Package |
Version: | Keywords: | ||
Cc: |
Description
If 'qgis-dev' has been started first, a following start of 'qgis' raises a Couldn't load plugin 'processing'
error due to broken GDAL pathes (see below).
This isse was initially reported to https://github.com/qgis/QGIS/issues/50890
Couldn't load plugin 'processing' ImportError: Traceback (most recent call last): File "F:\OSGeo4W\apps\gdal-dev\lib\site-packages\osgeo\__init__.py", line 30, in swig_import_helper return importlib.import_module(mname) File "F:\OSGeo4W\apps\Python39\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 666, in _load_unlocked File "", line 565, in module_from_spec File "", line 1173, in create_module File "", line 228, in _call_with_frames_removed ImportError: DLL load failed while importing _gdal: The specified module could not be found. On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH. If gdalXXX.dll is in the PATH, then set the USE_PATH_FOR_GDAL_PYTHON=YES environment variable to feed the PATH into os.add_dll_directory(). Traceback (most recent call last): File "F:\OSGeo4W\apps\gdal-dev\lib\site-packages\osgeo\__init__.py", line 30, in swig_import_helper return importlib.import_module(mname) File "F:\OSGeo4W\apps\Python39\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 666, in _load_unlocked File "", line 565, in module_from_spec File "", line 1173, in create_module File "", line 228, in _call_with_frames_removed ImportError: DLL load failed while importing _gdal: The specified module could not be found. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "F:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 401, in loadPlugin __import__(packageName) File "F:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "F:\OSGeo4W/apps/qgis/./python/plugins\processing\__init__.py", line 26, in from processing.tools.general import * # NOQA File "F:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "F:\OSGeo4W/apps/qgis/./python/plugins\processing\tools\general.py", line 32, in from processing.core.Processing import Processing File "F:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "F:\OSGeo4W/apps/qgis/./python/plugins\processing\core\Processing.py", line 58, in from processing.algs.qgis.QgisAlgorithmProvider import QgisAlgorithmProvider # NOQA File "F:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "F:\OSGeo4W/apps/qgis/./python/plugins\processing\algs\qgis\QgisAlgorithmProvider.py", line 49, in from .HypsometricCurves import HypsometricCurves File "F:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "F:\OSGeo4W/apps/qgis/./python/plugins\processing\algs\qgis\HypsometricCurves.py", line 27, in from osgeo import gdal, ogr, osr File "F:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "F:\OSGeo4W\apps\gdal-dev\lib\site-packages\osgeo\__init__.py", line 46, in _gdal = swig_import_helper() File "F:\OSGeo4W\apps\gdal-dev\lib\site-packages\osgeo\__init__.py", line 42, in swig_import_helper raise ImportError(traceback_string + '\n' + msg) ImportError: Traceback (most recent call last): File "F:\OSGeo4W\apps\gdal-dev\lib\site-packages\osgeo\__init__.py", line 30, in swig_import_helper return importlib.import_module(mname) File "F:\OSGeo4W\apps\Python39\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 666, in _load_unlocked File "", line 565, in module_from_spec File "", line 1173, in create_module File "", line 228, in _call_with_frames_removed ImportError: DLL load failed while importing _gdal: The specified module could not be found. On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH. If gdalXXX.dll is in the PATH, then set the USE_PATH_FOR_GDAL_PYTHON=YES environment variable to feed the PATH into os.add_dll_directory(). Python version: 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] QGIS version: 3.28.0-Firenze Firenze, ed3ad0430f3
Change History (4)
comment:1 by , 2 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 by , 2 years ago
Thanks for your reply. Yes indeed, calling qgis.exe
or qgis-dev.exe
directly, e.g. from windows explorer, avoids the error (similar to restarting the OSGeo4W shell). So the entire issue may have a low priority only.
Otherwise, I'd expect that each bat/exe that is listed by o-help
can be run in the OSGeo4W shell no matter which other bat/exe was executed before. At least in the OSGeo4W environment that I installed a couple of minutes ago (folder F:\OSGeo4W-2
) neither qgis.exe
nor qgis-dev.exe
is available (but the *.bat listed by o-help
).
F:\OSGeo4W-2>o-help -={ OSGeo4W Shell Commands }=- applygeo bgspawn brotli curl dllupdate gdaladdo gdalbuildvrt gdaldem gdalenhance gdalinfo gdallocationinfo gdalmanage gdalmdiminfo gdalmdimtranslate gdalsrsinfo gdaltindex gdaltransform gdalwarp gdal_contour gdal_create gdal_grid gdal_rasterize gdal_translate gdal_viewshed geotifcp getspecialfolder gnmanalyse gnmmanage iconv listgeo makegeo nearblack ogr2ogr ogrinfo ogrlineref ogrtindex osgeo4w-setup pdal pg_dump pg_dumpall pg_restore psql python python3 pythonw pythonw3 qgis-bin qgis-dev-bin sqlite3 textreplace xmlcatalog xmllint xxmklink gdal-dev-env gdal-dev-py-env o-help o4w_env python-qgis-dev python-qgis qgis-designer qgis-dev-designer qgis-dev qgis qgis_process-qgis-dev qgis_process-qgis setup GDAL 3.6.0, released 2022/11/06 F:\OSGeo4W-2>where qgis F:\OSGeo4W-2\bin\qgis.bat F:\OSGeo4W-2>where qgis-dev F:\OSGeo4W-2\bin\qgis-dev.bat F:\OSGeo4W-2>where qgis.exe INFO: Could not find files for the given pattern(s). F:\OSGeo4W-2>where qgis-dev.exe INFO: Could not find files for the given pattern(s).
comment:4 by , 2 years ago
You can also as set PYTHONPATH= to etc/ini/python3.bat to use the batch files.
Run the executable qgis{,-ltr,dev}-bin.exe instead of the batch file (like the shortcut would)