I’m trying to use the osgeo python module on an AWS EC2 instance (t3a.nano running Amazon Linux 2). From what I can gather I need to install the GDAL libraries, but am having a difficult time. When I try:
python -m pip install GDAL I get: ERROR: Command errored out with exit status 1: command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-J58vPK/GDAL/setup.py'"'"'; __file__='"'"'/tmp/pip-install-J58vPK/GDAL/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-t20qWh cwd: /tmp/pip-install-J58vPK/GDAL/ Complete output (50 lines): /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type' warnings.warn(msg) running egg_info creating /tmp/pip-pip-egg-info-t20qWh/GDAL.egg-info writing requirements to /tmp/pip-pip-egg-info-t20qWh/GDAL.egg-info/requires.txt writing /tmp/pip-pip-egg-info-t20qWh/GDAL.egg-info/PKG-INFO writing top-level names to /tmp/pip-pip-egg-info-t20qWh/GDAL.egg-info/top_level.txt writing dependency_links to /tmp/pip-pip-egg-info-t20qWh/GDAL.egg-info/dependency_links.txt writing manifest file '/tmp/pip-pip-egg-info-t20qWh/GDAL.egg-info/SOURCES.txt' Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-J58vPK/GDAL/setup.py", line 478, in <module> setup(**setup_kwargs) File "/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 129, in setup return distutils.core.setup(**attrs) File "/usr/lib64/python2.7/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 278, in run self.find_sources() File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 293, in find_sources mm.run() File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 524, in run self.add_defaults() File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 560, in add_defaults sdist.add_defaults(self) File "/usr/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 36, in add_defaults self._add_defaults_ext() File "/usr/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 119, in _add_defaults_ext build_ext = self.get_finalized_command('build_ext') File "/usr/lib64/python2.7/distutils/cmd.py", line 312, in get_finalized_command cmd_obj.ensure_finalized() File "/usr/lib64/python2.7/distutils/cmd.py", line 109, in ensure_finalized self.finalize_options() File "/tmp/pip-install-J58vPK/GDAL/setup.py", line 320, in finalize_options self.gdaldir = self.get_gdal_config('prefix') File "/tmp/pip-install-J58vPK/GDAL/setup.py", line 263, in get_gdal_config raise gdal_config_error(traceback_string + '\n' + msg) __main__.gdal_config_error: Traceback (most recent call last): File "/tmp/pip-install-J58vPK/GDAL/setup.py", line 257, in get_gdal_config return fetch_config(option) File "/tmp/pip-install-J58vPK/GDAL/setup.py", line 160, in fetch_config raise gdal_config_error, e""") File "<string>", line 4, in <module> gdal_config_error: [Errno 2] No such file or directory Could not find gdal-config. Make sure you have installed the GDAL native library and development headers. ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. So I’ve tried installing the GDAL libraries according to instructions on: https://trac.osgeo.org/gdal/wiki/BuildingOnUnix <https://trac.osgeo.org/gdal/wiki/BuildingOnUnix> % cd gdal % ./configure [options] % make % su Password: ******** # make install # exit When I run the ‘make’ command I get the following errors: libtool: compile: gcc -I/tmp/gdal-2.0.0/port -I/tmp/gdal-2.0.0/gcore -I/tmp/gdal-2.0.0/alg -I/tmp/gdal-2.0.0/ogr -I/tmp/gdal-2.0.0/ogr/ogrsf_frmts -g -O2 -Wall -Wdeclaration-after-statement -I/tmp/gdal-2.0.0/frmts/vrt -DOGR_ENABLED -I/tmp/gdal-2.0.0/port -DGDAL_COMPILATION -I/tmp/gdal-2.0.0/ogr/ogrsf_frmts/geojson/libjson -I/tmp/gdal-2.0.0/ogr/ogrsf_frmts/geojson -c gdalserver.c -fPIC -DPIC -o .libs/gdalserver.o gdalserver.c: In function 'CreateSocketAndBindAndListen': gdalserver.c:124:21: error: storage size of 'sHints' isn't known struct addrinfo sHints; ^~~~~~ gdalserver.c:126:31: error: invalid application of 'sizeof' to incomplete type 'struct addrinfo' memset(&sHints, 0, sizeof(struct addrinfo)); ^~~~~~ gdalserver.c:129:23: error: 'AI_PASSIVE' undeclared (first use in this function); did you mean 'AF_WANPIPE'? sHints.ai_flags = AI_PASSIVE; ^~~~~~~~~~ AF_WANPIPE gdalserver.c:129:23: note: each undeclared identifier is reported only once for each function it appears in gdalserver.c:132:12: warning: implicit declaration of function 'getaddrinfo' [-Wimplicit-function-declaration] nRet = getaddrinfo(NULL, pszService, &sHints, &psResults); ^~~~~~~~~~~ gdalserver.c:135:48: warning: implicit declaration of function 'gai_strerror'; did you mean 'strerror'? [-Wimplicit-function-declaration] fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(nRet)); ^~~~~~~~~~~~ strerror gdalserver.c:135:42: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'int' [-Wformat=] fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(nRet)); ~^ ~~~~~~~~~~~~~~~~~~ %d gdalserver.c:141:39: error: dereferencing pointer to incomplete type 'struct addrinfo' psResultsIter = psResultsIter->ai_next) ^~ gdalserver.c:162:5: warning: implicit declaration of function 'freeaddrinfo' [-Wimplicit-function-declaration] freeaddrinfo(psResults); ^~~~~~~~~~~~ gdalserver.c:124:21: warning: unused variable 'sHints' [-Wunused-variable] struct addrinfo sHints; ^~~~~~ make[1]: *** [gdalserver.lo] Error 1 make[1]: Leaving directory `/tmp/gdal-2.0.0/apps' make: *** [apps-target] Error 2 Any help would be greatly appreciated. Lee
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev