Python and GDAL Installation Automated for Windows 10

Original article was published by on AI Magazine

Are you a beginner at Python for Geospatial Processing? Do you find the installation process a wee bit cumbersome? Then you have come to the right place! For experts in the field out there, I hope this will save you from some amount of manual work if you are using Windows 10.

Ok! Let’s get started!

Go to this GitHub repo and download the Python_GDAL_(32/64).bat file, please make sure you save it as a batch file (*.bat).

Right-click on the downloaded file and select “Run as administrator”.

Run the downloaded file with admin privileges.

The script will download the setup files and run them one by one, make sure you are connected to the internet. If your connection is too slow or the download server is down by any chance, the script will terminate. In that case, you can simply re-run it.

Once the files are downloaded, the Python installation window will automatically pop up, then you will have to select “Customize installation” as shown in the image below.

Choose custom installation

Follow the instructions and continue the installation until you reach the Advanced Options window. Reduce the installation path as shown below. This is a mandatory step and the only thing that you need to take care of in the entire process.

Shorten the directory

Click on the install button and wait for the installation to finish. After successful installation, the GDAL installation window will pop up, don’t change anything, and keep clicking next to finish the installation. When asked, select the Typical installation.

Finally, the installation of the GDAL module for Python will begin, keep everything default, install for all users, and check that the installation is being done for the correct Python instance, as shown in the image below.

Select Python 3.7 from the registry

If this is the first Python 3.7 installation on the system and there are no conflicting installations, the process will be smooth.

On completion, the installation program will automatically close in 30 seconds. Open command prompt from Start menu and type python37 to launch Python, or search in the Start menu for Python 3.7 IDLE and open it. Type import gdal in the console, and ideally, it should not print anything on the screen. If it throws an error, try uninstalling Python and GDAL from the Add or remove programs option in the Start menu or Control Panel and retry the installation using the (*).bat file. Feel free to write a response to this post if you face any other issues.

That’s it for this post. If you want to get started with machine learning methods for geospatial tasks, such as Landsat multispectral classification, you may find the following posts useful.

1. Neural Network for Satellite Data Classification Using Tensorflow in Python
2. Is CNN equally shiny on mid-resolution satellite data?

Always happy to connect to you — Twitter, LinkedIn.

Share open knowledge!