Location>code7788 >text

Installing GDAL in Anaconda with a whl file

Popularity:42 ℃/2024-08-17 18:54:02

  This article describes how inAnacondaenvironment, based on the.whlfile installationPythonIntermediate and advanced geographic data-processing librariesGDALThe methodology.

  In a previous post, we described the process of creating an application based on theconda installcommand to install directly over the networkGDALlibrary method; however, as shown below, this method ofEnvironment ConfigurationThe process is very slow and sometimes there are conflicts between different third-party libraries, so it's not a very good approach.

image

  Therefore, in this paper, we present the results based on the.whlfile to quickly configureGDALThe library approach.

  It is important to mention at the outset that in earlier times (probably2023years ago), it is possible to start with aWindowsPlatform categoriesPythonthird-party repository.whldocumentationCompilation Sitesto downloadGDAL(used form a nominal expression).whlfile, as shown below.

  However, the above site has since been shut down, so it will be necessary to visit anothernode, as shown in the figure below.

  Subsequently, in "Assets", select "Show all XXX assets" option, as shown below.

  Find what we need hereGDALlibrary version of the.whlfile will suffice. Note here that the individual.whlfile, the first string of numbers before it indicates theGDALversion of the library.cpfollowed by a number indicatingPythonversion, the finalwin32together withamd64represent respectively32Bit system with64bit system. For example, I have here thePythonThe version is3.9.1and the computer is64bit, so just choose the one with thecp39cap (a poem)amd64model or template.whlDocumentation is sufficient.

  Subsequently, download.whlfile and place it under a certain path.

  Afterwards, open "Anaconda Prompt (anaconda3)"Software.

  and go to where we've just stored the.whlfile in the path of the file. For example, I'm accessing it here via the following code:

cd C:\GDAL_P39

  Then press the Enter key as shown below.

  Next, typepip installand followed by the one you just downloaded..whlThe full name of the file. For example, I need to enter here:

pip install GDAL-3.4.3-cp39-cp39-win_amd64.whl

  Then press the Enter key as shown below.

  If the screen as shown above appears, it indicates that we have completed theGDALThe configuration of the library works; we can continue to work on the "Anaconda Prompt (anaconda3)" in which the success of the configuration work is tested.

  We enter the following code on the command line:

python

  Afterwards, enter the following code:

from osgeo import gdal

  If the interface shown below appears after entering the above two codes (i.e., no error message pops up), it means that theGDALThe library has been configured successfully.

  At this point, the job is done.