0

I am following the following tutorial with creating a Geo Location based web app. Although, I've ran in to a few challenges which I've been trying to figure out how to resolve.

Reference to GeoDjango tutorial: https://realpython.com/location-based-app-with-geodjango-tutorial/

Per the instructions (on the link provided above) - I have included django.contrib.gis as apart of my Installed Apps. Although, Gunicorn is failing to start when this include is in place.

So I'm guessing it will most likely be because I need to install other relevant libraries in order to get GeoDjango working.

I did a little digging online and came across this link - https://docs.djangoproject.com/en/3.2/ref/contrib/gis/install/geolibs/

Which seems to references the libraries which need to be installed.

I have managed to install GEOS and PROJ perfectly fine. Although, the final requirement is to install GDAL.

So I found the relevant install command for GDAL pip3 install gdal but I am receiving the following error when installing this library within the SSH console.

   Running setup.py install for gdal ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xjvcvnos/gdal_5ab038f0da3b44488d8b78e9cb9b461a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xjvcvnos/gdal_5ab038f0da3b44488d8b78e9cb9b461a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-p1c_7as0/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6m/gdal
         cwd: /tmp/pip-install-xjvcvnos/gdal_5ab038f0da3b44488d8b78e9cb9b461a/
    Complete output (28 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    copying gdal.py -> build/lib.linux-x86_64-3.6
    copying ogr.py -> build/lib.linux-x86_64-3.6
    copying osr.py -> build/lib.linux-x86_64-3.6
    copying gdalconst.py -> build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/osgeo
    copying osgeo/__init__.py -> build/lib.linux-x86_64-3.6/osgeo
    copying osgeo/gdal.py -> build/lib.linux-x86_64-3.6/osgeo
    copying osgeo/gdal_array.py -> build/lib.linux-x86_64-3.6/osgeo
    copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.6/osgeo
    copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.6/osgeo
    copying osgeo/ogr.py -> build/lib.linux-x86_64-3.6/osgeo
    copying osgeo/osr.py -> build/lib.linux-x86_64-3.6/osgeo
    running build_ext
    Could not run gdal-config!!!!
    building 'osgeo._gdal' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/extensions
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/usr/include/python3.6m -I. -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.6/extensions/gdal_wrap.o
    extensions/gdal_wrap.cpp:2813:10: fatal error: cpl_port.h: No such file or directory
     #include "cpl_port.h"
              ^~~~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xjvcvnos/gdal_5ab038f0da3b44488d8b78e9cb9b461a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xjvcvnos/gdal_5ab038f0da3b44488d8b78e9cb9b461a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-p1c_7as0/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6m/gdal Check the logs for full command output.

I am running the latest version of Django and I am using pip version 21.1.1 on my CentOS server.

Does anyone have any ideas or suggestions with where I could be going wrong here? :-)

Thanks!

Jarjar95
  • 77
  • 8

0 Answers0