4

I'm trying to install QGIS using the Anaconda package manager in a new environment. I have done this successfully before (not sure if it was on this specific Windows laptop, but probably) and also have colleagues who have it running on Windows.

I install it a new environment with:

conda create -n qgis-test -c conda-forge qgis

I activate the environment and try to launch QGIS at the command line. I get the following message:

The procedure entry point ?data@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAPEADXZ could not be located in the dynamic link library C:\Miniconda3\envs\qgis-test\Library\bin\gdal304.dll.

Similar questions/answers in GIS.SE are old (in some cases quite old). They also refer to copying DLLs or changing paths, which seems less than promising to me, as I have colleagues running this on very similar setups (including having QGIS installed separately through OSGeo4W). I also thought that Anaconda's virtual environment sandboxing would prevent DLLs outside the environment directory from short circuiting the path search.

For what it's worth, where qgis indicates that I am running the expected binary (C:\Miniconda3\envs\qgis-test\Library\bin\qgis.exe), and C:\Miniconda3\envs\qgis-test\Library\bin\gdal304.dll does in fact exist.

A partial result of conda list with potentially relevant packages:

gdal                      3.4.1           py310h7990aed_4    conda-forge
libgdal                   3.4.1                h6b2b983_4    conda-forge
python                    3.10.4          h9a09f29_0_cpython    conda-forge
qgis                      3.18.3          py310h341bce4_9    conda-forge

1 Answer 1

4

As of March 2022, the highest version of QGIS available in conda-forge is 3.18. This works with GDAL 3.3, but does not seem to work with GDAL 3.4. Thus, the solution is to pin an older version of GDAL.

Install QGIS in a new environment as follows:

conda create -n <my-qgis-env> -c conda-forge qgis gdal=3.3

After doings so, QGIS will launch successfully.

If you have already installed QGIS without specifying the GDAL version, you should be able to downgrade GDAL with:

conda install gdal=3.3

This solution probably only applies to QGIS 3.18 and may change in the future if higher versions of QGIS make their way into conda-forge.

Check the current package version at https://anaconda.org/conda-forge/qgis

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.