Installing geopandas on Windows can be intimidating, so, going through the tutorials and documentation, here is how to install it and use it on Windows.
First, we need to install Python, pip and its perquisites. We will be using Python 3.7 (NOTE THAT YOU CANNOT USE Python 3.8 AT THE MOMENT OF WRITING THIS ARTICLE, SINCE FIONA.whl IS STILL NOT AVAILABLE FOR Python 3.8) .
So, hop to python's website and download the binaries here. When downloaded, install it the regular way and set the installation directory to be root of your Windows drive: C:\Python37. Also, add Python to the PATH (you will be asked during the installation). Once done, we can start installing pip things.
So, open up your CMD as Administrator and type:
This will install pip and necessary pip packages.
Now, we will start installing geopandas.
First, we will not be installing dependencies through pip, but from .whl files. The dependencies that we will need are and can be found on these urls: GDAL, Fiona, pyproj, rtree and shapely. The links I provided are to the website where you can find .whl files for each architecture and each Python version. Since we have Python 3.7, we will only need to know our architecture type, whether it is a 32bit or 64bit. Since the download I provided is using 32bit Python, please download the specified files bellow .whl package:
Please NOTE: GDAL version needs to be 2.4.1 since it compatible with all other .whl files. If you choose 3.0.1, this won't work
Alright, great, now, we need to install them, one by one.
I suggest creating virtual env for this, but, you can do it however you want, so, first, we need to install GDAL:
When we have done this, we need to set ENVIRONMENT VARIABLE. To do this, please
right click on "This PC"->"Properties"->"Advanced System Settings"->"Environment
Variables" and to the top of this screen, you will see "Path" in the list.
Select it and click "Edit". After that, click on "New" and add it like:
Now we can continue with installation of other .whl files. Close the CMD and reopen it again so that ENV variable can kick in.
Alright, so, we are done with the installation, let us check if GDAL is working.
Close and open your CMD and type:
If all is good, you should see:
There is an error when installing GDAL that needs to be fixed. Basically, GDAL
will tell you that it cannot find the module, but the module is there:
ERROR 1: Can't load requested DLL: C:\project\virtualenv\Lib\site-packages\osgeo\gdalplugins\ogr_FileGDB.dll
Even tough the file is there, this error will be thrown.
So, to fix this, we need to move that file (Move, not Copy) out of the gdalplugins and into the osgeo folder.
Now, when you run again the command from above, you will get no errors.
In order to test this in Python code, create a script and run it:
So, this is how to install and use GDAL on Windows! Happy coding!