Installing GeoPandas with Its Dependencies, without installing Microsoft Visual C++

The Problem

If you try to install GeoPandas with pip install geopandas, you may get an error like below. Since you don’t have the dependency GDAL installed, the installer cannot find the config and exits.

  Downloading Fiona-1.8.21.tar.gz (1.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 2.2 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      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 varble.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Then you try installing gdal with pip install gdal and you get another error saying:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-buuild-tools/

The Solution

Christoph Gohlke from the University of California maintains binaries for many popular scientific Python packages; so that you don’t have to install Microsoft Visual C++ to compile these during the installation.

You can download these from his personal page on the university website and simply install the dependencies you need from these packages with pip as below. I got GDAL and Fiona missing so I got those installed before installing GeoPandas.

cd directoryWhereYouDownloaded
pip install GDAL-3.4.1-cp310-cp310-win_amd64.whl
pip install Fiona-1.8.21-cp310-cp310-win_amd64.whl