With Anaconda, it is quite straightforward. All you need to do is run
conda install geopandas
and it will not only install geopandas, but also its dependencies. This is the method recommended on the geopandas installation page. They say, and I quote,
The advantage of using the conda package manager is that it provides pre-built binaries for all the required and optional dependencies of GeoPandas for all platforms (Windows, Mac, Linux).
If you are not using Anaconda (which is probably why you are here), it becomes a bit tricky on Windows. You may try running
pip install geopandas
It will download all the other dependencies required for geopandas (shapely, six, pyproj, rtree, etc.). However, it will fail to build the .whl for fiona. You will get an error similar to the following:
A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
And because of the above, if you run import geopandas, you will get the following error:
No module named 'geopandas'
This is expected. On the geopandas installation page, they have mentioned that fiona provides binary wheels with the dependencies included for Mac and Linux, but not for Windows. Thus, we first need to download the Windows wheel for fiona. They have provided the source on the geopandas installation page: Christopher Gohlke’s website.
On this website, the unofficial wheel files for various packages are found. Search for fiona on this site, and download the whl file for your python version, and your Windows type.
I’m using Python 3.8, and 64-bits Windows machine. Thus, I’ll go with Fiona‑1.8.20‑cp38‑cp38‑win_amd64.whl. Over here, 1.8.20 refers to the version of fiona. At the time of writing this post, this is the latest version. Download that whl file, and note its location. On my machine, it is saved in the Downloads folder. The complete path is C:/Users/Yash/Downloads/Fiona-1.8.19-cp38-cp38-win_amd64.whl.
Next, search for gdal on the same website, and download the latest version matching your python version and Windows type. I downloaded GDAL-3.3.1-cp38-cp38-win_amd64.whl, in the same Downloads folder. GDAL is required for Fiona to get installed.
Now, install GDAL followed by Fiona using pip install
pip install C:/Users/Yash/Downloads/GDAL-3.3.1-cp38-cp38-win_amd64.whl pip install C:/Users/Yash/Downloads/Fiona-1.8.19-cp38-cp38-win_amd64.whl
Both GDAL and Fiona should get installed. Now try installing geopandas again.
pip install geopandas
It should get successfully installed now. That’s it. I hope this article helped you. Check out more posts on python on iotespresso.com.
If you are interested in data science, visualization, and machine learning using Python, you may find this course by Jose Portilla on Udemy to be very helpful. It has been the foundation course in Python for me and several of my colleagues.