Geopandas kann auf Python3 nicht installiert werden

Geopandas kann auf Python3 nicht installiert werden

Ich erhalte diesen Fehler beim Versuch, mit geopandaszu installierenUbuntu 20.04Python3.7

Folgendes mache ich:

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

Unterhalb des Prozesses

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/

Antwort1

Entsprechend derGeopandas-Dokumentation(Hervorhebung von mir):

Abhängig von Ihrer Plattform müssen Sie möglicherweise kompilieren und installieren ihre C-Abhängigkeiten manuell.Weitere Einzelheiten zur Installation finden Sie in den einzelnen Paketen. Wenn Sie conda verwenden (siehe oben), müssen Sie die Abhängigkeiten nicht selbst kompilieren.

Stellen Sie daher sicher, dass Sie Folgendes haben python-devund build-essentialinstalliert haben, bevor Sie es ausführen pip install .:

sudo apt install python3-dev build-essential
  • python3-deventhält Header-Dateien und eine statische Bibliothek für Python und sollte standardmäßig bereits installiert sein. Es wird erwähnt indiese ähnliche SO-Frageund scheint das Problem des OP zu lösen.

  • build-essentialist ein Metapaket, das die gängigsten Tools ( gcc, g++, make, usw.) installiert, die zum Kompilieren von Paketen benötigt werden.

verwandte Informationen