emax
emax

Reputation: 7235

Unable to install geopandas on python3.9 on macOS Big Sur

I am trying to install geopandas on the machine described above.

This is what I am doing the error I get:

sudo pip3 install geopandas

Collecting geopandas
  Downloading geopandas-0.8.1-py2.py3-none-any.whl (962 kB)
     |████████████████████████████████| 962 kB 5.0 MB/s 
Collecting fiona
  Downloading Fiona-1.8.18.tar.gz (1.3 MB)
     |████████████████████████████████| 1.3 MB 4.8 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/[email protected]/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-fbu0u179/fiona/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-fbu0u179/fiona/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/tmp/pip-pip-egg-info-knmlby9t
         cwd: /private/tmp/pip-install-fbu0u179/fiona/
    Complete output (2 lines):
    Failed to get options via gdal-config: [Errno 2] No such file or directory: 'gdal-config'
    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.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Upvotes: 0

Views: 1480

Answers (1)

KindOfLuke
KindOfLuke

Reputation: 51

GDAL is a required library for Geopandas and it needs to be built and compiled on your system and in your path before you pip install geopandas

If you are using homebrew, you can install it with

brew install gdal

and verify the installation by running

gdal-config --version

One note is that Gdal has a lot of dependencies and will take a bit to install. Using homebrew, it worked for me in one shot but it will likely upgrade a number of prerequisites including GCC and perhaps even python itself.

I should note that this worked for me on Catalina. If you are an M1 Mac with Big Sur every tool in this chain may not be upgradeable to native M1 code at this time and you may need some of the workarounds at How to run the Homebrew installer under Rosetta 2 on M1 Macbook

Upvotes: 1

Related Questions