0

I am getting this error while I am trying to install geopandas on Ubuntu 20.04 with Python3.7

This is what I am doing:

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

Below the process

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
  • »»pip install . «« : If you want a Python3 install, it is pip3 install [target] May 25, 2021 at 16:40

1 Answer 1

0

According to the Geopandas documentation (emphasis my own):

Depending on your platform, you might need to compile and install their C dependencies manually. We refer to the individual packages for more details on installing those. Using conda (see above) avoids the need to compile the dependencies yourself.

So make sure you have python-dev and build-essential installed before running pip install .:

sudo apt install python3-dev build-essential
  • python3-dev contains header files and a static library for Python and should be already installed by default. It is mentioned in this similar SO question and seems to solve the OP's issue.

  • build-essential is a meta-package that installs the most common tools (gcc, g++, make, etc.) needed for compiling packages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .