Não é possível instalar geopandas em Python3

Não é possível instalar geopandas em Python3

Estou recebendo este erro enquanto tento geopandasinstalar Ubuntu 20.04comPython3.7

Isso é o que estou fazendo:

git clone https://github.com/geopandas/geopandas.git
cd geopandas
pip install .

Abaixo do processo

Processing /home/d1-user/geopandas
Requirement already satisfied: pandas>=0.24.0 in /usr/local/lib/python3.7/site-packages (from geopandas==0.9.0+25.gdd2ed8e) (1.1.5)
Requirement already satisfied: shapely>=1.6 in /usr/local/lib/python3.7/site-packages (from geopandas==0.9.0+25.gdd2ed8e) (1.7.1)
Requirement already satisfied: fiona>=1.8 in /usr/local/lib/python3.7/site-packages (from geopandas==0.9.0+25.gdd2ed8e) (1.8.19)
Collecting pyproj>=2.2.0 (from geopandas==0.9.0+25.gdd2ed8e)
  Using cached https://files.pythonhosted.org/packages/7c/1d/20ea3b603db61ccc60f45064a9e00ba2e6263f1de560e33306f6f3d42fcb/pyproj-3.1.0.tar.gz
  Installing build dependencies ... done
Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.7/site-packages (from pandas>=0.24.0->geopandas==0.9.0+25.gdd2ed8e) (2021.1)
Requirement already satisfied: numpy>=1.15.4 in /usr/local/lib/python3.7/site-packages (from pandas>=0.24.0->geopandas==0.9.0+25.gdd2ed8e) (1.20.3)
Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/site-packages (from pandas>=0.24.0->geopandas==0.9.0+25.gdd2ed8e) (2.8.1)
Requirement already satisfied: certifi in /usr/local/lib/python3.7/site-packages (from fiona>=1.8->geopandas==0.9.0+25.gdd2ed8e) (2020.12.5)
Requirement already satisfied: six>=1.7 in /usr/local/lib/python3.7/site-packages (from fiona>=1.8->geopandas==0.9.0+25.gdd2ed8e) (1.16.0)
Requirement already satisfied: click-plugins>=1.0 in /usr/local/lib/python3.7/site-packages (from fiona>=1.8->geopandas==0.9.0+25.gdd2ed8e) (1.1.1)
Requirement already satisfied: cligj>=0.5 in /usr/local/lib/python3.7/site-packages (from fiona>=1.8->geopandas==0.9.0+25.gdd2ed8e) (0.7.1)
Requirement already satisfied: click<8,>=4.0 in /usr/local/lib/python3.7/site-packages (from fiona>=1.8->geopandas==0.9.0+25.gdd2ed8e) (7.1.2)
Requirement already satisfied: munch in /usr/local/lib/python3.7/site-packages (from fiona>=1.8->geopandas==0.9.0+25.gdd2ed8e) (2.5.0)
Requirement already satisfied: attrs>=17 in /usr/local/lib/python3.7/site-packages (from fiona>=1.8->geopandas==0.9.0+25.gdd2ed8e) (21.2.0)
Installing collected packages: pyproj, geopandas
  Running setup.py install for pyproj ... error
    Complete output from command /usr/local/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-4tpthiyu/pyproj/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-56avnl0l/install-record.txt --single-version-externally-managed --compile:
    /tmp/pip-build-env-xjhuovi8/lib/python3.7/site-packages/setuptools/dist.py:694: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
      % (opt, underscore_opt))
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/_show_versions.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/utils.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/proj.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/compat.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/enums.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/network.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/datadir.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/exceptions.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/sync.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/aoi.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/geod.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/__init__.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/transformer.py -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/__main__.py -> build/lib.linux-x86_64-3.7/pyproj
    creating build/lib.linux-x86_64-3.7/pyproj/crs
    copying pyproj/crs/_cf1x8.py -> build/lib.linux-x86_64-3.7/pyproj/crs
    copying pyproj/crs/enums.py -> build/lib.linux-x86_64-3.7/pyproj/crs
    copying pyproj/crs/datum.py -> build/lib.linux-x86_64-3.7/pyproj/crs
    copying pyproj/crs/__init__.py -> build/lib.linux-x86_64-3.7/pyproj/crs
    copying pyproj/crs/coordinate_system.py -> build/lib.linux-x86_64-3.7/pyproj/crs
    copying pyproj/crs/coordinate_operation.py -> build/lib.linux-x86_64-3.7/pyproj/crs
    copying pyproj/crs/crs.py -> build/lib.linux-x86_64-3.7/pyproj/crs
    copying pyproj/_sync.pyi -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/_transformer.pyi -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/_geod.pyi -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/list.pyi -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/database.pyi -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/_crs.pyi -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/_datadir.pyi -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/_network.pyi -> build/lib.linux-x86_64-3.7/pyproj
    copying pyproj/py.typed -> build/lib.linux-x86_64-3.7/pyproj
    running build_ext
    building 'pyproj._geod' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/pyproj
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/local/include/python3.7m -c pyproj/_geod.c -o build/temp.linux-x86_64-3.7/pyproj/_geod.o
    pyproj/_geod.c:639:10: fatal error: geodesic.h: No such file or directory
      639 | #include "geodesic.h"
          |          ^~~~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/local/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-4tpthiyu/pyproj/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-56avnl0l/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-4tpthiyu/pyproj/

Responder1

De acordo comDocumentação de geopandas(ênfase minha):

Dependendo da sua plataforma, pode ser necessário compilar e instalar suas dependências C manualmente.Referimo-nos aos pacotes individuais para obter mais detalhes sobre como instalá-los. Usar conda (veja acima) evita a necessidade de compilar você mesmo as dependências.

Portanto, certifique-se de ter python-deve build-essentialinstalar antes de executar pip install .:

sudo apt install python3-dev build-essential
  • python3-devcontém arquivos de cabeçalho e uma biblioteca estática para Python e já deve estar instalado por padrão. É mencionado emesta pergunta SO semelhantee parece resolver o problema do OP.

  • build-essentialé um meta-pacote que instala as ferramentas mais comuns ( gcc, g++, make, etc.) necessárias para compilar pacotes.

informação relacionada