Bug report #19029
GDAL functions ImportError: DLL load failed. The operating system cannot run %1.
|Affected QGIS version:||3.0.3||Regression?:||No|
|Operating System:||Windows 7 Professional||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||worksforme|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||26860|
The problem that occurs is similar to an earlier issue that has been closed (#4370). It might be that the conclusion of that issue from 6 years ago still holds today, but I'd figure I'd ask again. Sorry if this is a waste of time. If it is, this issue can quickly be closed.
When attempting to run functions under the Raster dropdown menu (e.g. Raster > Miscellaneous > Merge...), a lot of these fail because of an 'ImportError: DLL load failed. The operating system cannot run %1.' (see figure). I've been able to establish that the cause is that LIBEAY32.dll (a dependency of GDAL202.dll) is found in C:\Windows first, instead of the one in the QGIS bin directory.
Is it somehow possible to force QGIS to look in its own directory first? Or is there any other method to avoid this conflict? I've now solved it by renaming the windows LIBEAY32.dll file, which doesn't seem like the best idea...
#2 Updated by Jürgen Fischer over 2 years ago
Davíd Brakenhoff wrote:
Is it somehow possible to force QGIS to look in its own directory first? Or is there any other method to avoid this conflict?
No, see #4370-5. But for that reason the qgis executables are all in
%OSGEO4W_ROOT%\bin next to
gdal202.dll. But that covers only QGIS itself. Can you verify which python executable you are running? ie.
bin/python3.exe or apps/Python36/python.exe - the latter should show those symptom, while the first two should not.
I've now solved it by renaming the windows LIBEAY32.dll file, which doesn't seem like the best idea...
LIBEAY32.dll should not be in
system32 - I'd move it to the software that put it there.
#3 Updated by Davíd Brakenhoff over 2 years ago
As far as I can tell,
gdal_merge.bat sets the
c:\Program Files\QGIS 3.0\bin\python.exe as python version to be used. In CMD, after calling
D:\>where python c:\Program Files\QGIS 3.0\bin\python.exe D:\>echo %PATH% c:\PROGRA~1\QGIS3~1.0\apps\Python27\Scripts;c:\PROGRA~1\QGIS3~1.0\bin;C:\Windows \system32;C:\Windows;C:\Windows\system32\WBem
You suggest that python executable should not being showing that symptom, but it seems that it is on my machine.
As for moving
libeay32.dll, that seems like a reasonable solution (just quite a pain to figure out what was actually causing the problem). I'll check with our IT department if they know which application put it there (company computer).