How to work with multiple version of GDAL on windows os

After I have installed QGIS from OSGeo4w and added some enviroment of GDAL to the system path on my windows 10 computer, I get some error information from SNAP GPT command line, like below:

INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
ERROR 1: Can’t load requested DLL: C:\OSGeo4W64\bin\gdalplugins\gdal_ECW_JP2ECW.dll
126: can not find module

ERROR 1: Can’t load requested DLL: C:\OSGeo4W64\bin\gdalplugins\ogr_SOSI.dll
126: can not find module

However, the gpt program seems still work on (for processing sentinel-1), and I get the anticipated result map as usual. But I am not sure whethere there is some process failed. The error infomation exists even after I have removed all the environment related to GDAL from the system path (I have not restart the computer).

I have checked that gdal used by the snap seems to be included in the “” file as below,

#SNAP configuration ‘s2tbx’
#Sun Jul 26 08:06:53 CST 2020
s2tbx.dataio.maxTime=One week

I wonder how can I fix the gdal warnings/errors with more than one gdal version installed on the computer?

which ones and why? QGIS finds its libraries without setting variables, and you don’t risk mixing different instances.

I have added GDAL_DATA, GDAL_DRIVER_PATH, PYTHON, PROJ_LIB et al to the system environment in order to use the QGIS module standlone from python.
Sorry for post this question in a hurry. Now I have fixed the problem by removing all the environment and restart the computer. It is better do this by temperally change the environment in the python environment.

You can put some code to your Python launcher or even at the beginning of your code (e.g. as a separate function “import-paths”) to include these directories.

Dear @ABraun

Actually I had problem that I mentioned here;

I tried to solve it by downloading below file from Esri:
which includes:

then I unzipped it and put its files in:

Then I run the code by using: python

I got below error:

ERROR 1: Can’t load requested DLL: C:\ProgramData\Anaconda3\envs\mysnap\lib\site-packages\osgeo\gdalplugins\ogr_FileGDB.dll
126: The specified module could not be found.

ERROR 1: Can’t load requested DLL: C:\ProgramData\Anaconda3\envs\mysnap\lib\site-packages\osgeo\gdalplugins\ogr_FileGDB.dll
126: The specified module could not be found.

I tried to import the dll directly by following codes based on your suggestion here:

**import ctypes **

but again I got below error:

Traceback (most recent call last):
File “”, line 5, in
File “C:\ProgramData\Anaconda3\envs\mysnap\lib\”, line 366, in init

I do not know what is the solution?

sorry, this is beyond my understanding of libraries and drivers.

1 Like

I can’t provide a solution either, but I found some interesting chats:

At least it shows that you are not alone having this issue.
Maybe the other results of the search are of help too.
Bing search: “gdalplugins\ogr_FileGDB.dll”

When using GDAL libraries with python they need to be built with the same compiler that was used for python. This is a common problem on Windows as many different compilers are used (Microsoft cc, GNU gcc, Intel icc, clang). If you are using Anaconda Python you should look for a suitable GDAL package from Anaconda or conda-forge. Linux is usually simpler as most packages use GNU gcc. For Windows 10, WSL2 allows you to use linux for command-line processing.