Installing GDAL using conda

Using conda to install GDAL gives you more flexibility in choosing a preferred Python version than Anaconda3. If you open up a terminal, you can use the conda search gdal command to print a list of available gdal versions and the corresponding Python version. If you want to know the dependencies for each package, type conda info gdal. Particular versions of GDAL depend on a specific package version, which can be a problem if you have these already installed, for example, NumPy. Then, you can create a virtual environment to install and run GDAL and their dependencies with the accompanying Python version, for example:

(C:Users<UserName> conda create -n myenv python=3.4
(C:Users<UserName> activate myenv # for Windows only. macOS and Linux users type "source activate myenv"
(C:Users<UserName> conda install gdal=2.1.0

You will be asked to proceed or not. If you confirm with y and hit Enter, a set of additional packages will be installed. These are called dependencies, which are packages that GDAL requires in order to function.

As you can see, conda does not list the latest GDAL version, 2.2.2, when you type in conda search gdal. Remember that in Chapter 1Package Installation and Management, we stated that conda does not always have the latest test versions of packages available for installation that are available in other ways. This is one such case.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset