Installing geopandas on Windows

pandas
geodata
Author

Teresa Kubacka

Published

May 26, 2023

The first time I tried to make geopandas work on Windows, I spent 2 days struggling. The official way to install it using conda never worked for me. Finally I found a way, but I was terrified of having to do it again, so I tried to keep and reuse this virtual environment as long as I can. Unfortunately, some time ago I had to nuke my whole Anaconda installation in order to upgrade the base Python and lost the environment. Luckily, I found this excellent tutorial by Francis Adrian Viernes that helped me set up a geopandas environment in no time!

Here are the steps, how they worked for me:

  1. Create a new environment (I used conda for this)
  2. Know your Python version (your Python version is the same as your CPython version) by running python -V in your environment. Alternatively you can run conda info and look at user-agent.
  3. Install the latest MS Visual C++ binaries for the X64 architecture (permalink to the .exe)
  4. Download precompiled wheels for geopandas dependencies from Christoph Gohlke’s geospatial wheels repository1. For a 64-bit system, choose win_amd64 suffix. Pick the wheel for your Python version, e.g. for Python 3.9 take a wheel described as cp39. Do NOT change the file name.
  1. Install the wheel in exactly the same sequence as listed: GDAL -> PyProj -> Fiona -> Shapely with pip. Open conda shell, navigate to the folder where your wheels are and for each wheel, run:
pip install relevant_file_name.whl
  1. In the last step, install geopandas with pip from pypi (there is no wheel available):
pip install geopandas

This recipe worked for Windows 10 Professional, Python 3.9.12, conda 4.12.0, pip 22.3, GDAL 3.4.3, PyProj 3.3.1, Fiona 1.8.21, Shapely 1.8.2, geopandas 0.12.1.

Footnotes

  1. Note: Gohlke’s wheels used to be hosted on his University of California, Irvine webpage. This page is no longer functional.↩︎