Python3에 geopandas를 설치할 수 없습니다.

Python3에 geopandas를 설치할 수 없습니다.

geopandas에 설치하려고 할 때 이 오류가 발생합니다 Ubuntu 20.04.Python3.7

이것이 내가 하고 있는 일이다:

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

프로세스 아래

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/

답변1

에 따르면Geopandas 문서(내 자신을 강조):

플랫폼에 따라 컴파일하고 설치해야 할 수도 있습니다. C 의존성을 수동으로.설치에 대한 자세한 내용은 개별 패키지를 참조하세요. conda(위 참조)를 사용하면 종속성을 직접 컴파일할 필요가 없습니다.

따라서 실행하기 전에 다음을 설치 python-dev했는지 확인하십시오 .build-essentialpip install .

sudo apt install python3-dev build-essential
  • python3-dev헤더 파일과 Python용 정적 라이브러리가 포함되어 있으며 기본적으로 이미 설치되어 있어야 합니다. 에 언급되어 있습니다.이 비슷한 SO 질문OP의 문제를 해결하는 것 같습니다.

  • build-essentialgcc패키지 컴파일에 필요한 가장 일반적인 도구( , g++, make등) 를 설치하는 메타 패키지입니다 .

관련 정보