1

I am using the Google App Engine to deploy a Flask app with Python GDAL Bindings. I've been mostly following this thread. I feel like I'm getting close but I'm running into an error where the build can't find gdal-config. I'm not sure where this is supposed to be/how it's supposed to be found. The whole error is lengthy, but here it is:

Collecting GDAL==3.1.0
  Downloading GDAL-3.1.0.tar.gz (592 kB)
    ERROR: Command errored out with exit status 1:
     command: /env/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4dzguh2n/GDAL/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4dzguh2n/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-u376etaq
         cwd: /tmp/pip-install-4dzguh2n/GDAL/
    Complete output (119 lines):
    WARNING: numpy not available!  Array support will not be enabled
    running egg_info
    creating /tmp/pip-pip-egg-info-u376etaq/GDAL.egg-info
    writing /tmp/pip-pip-egg-info-u376etaq/GDAL.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-pip-egg-info-u376etaq/GDAL.egg-info/dependency_links.txt
    writing requirements to /tmp/pip-pip-egg-info-u376etaq/GDAL.egg-info/requires.txt
    writing top-level names to /tmp/pip-pip-egg-info-u376etaq/GDAL.egg-info/top_level.txt
    writing manifest file '/tmp/pip-pip-egg-info-u376etaq/GDAL.egg-info/SOURCES.txt'
    Traceback (most recent call last):
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/opt/python3.7/lib/python3.7/subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "/opt/python3.7/lib/python3.7/subprocess.py", line 1551, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config': '../../apps/gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 250, in get_gdal_config
        return fetch_config(option, gdal_config=self.gdal_config)
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    __main__.gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config': '../../apps/gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/opt/python3.7/lib/python3.7/subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "/opt/python3.7/lib/python3.7/subprocess.py", line 1551, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 257, in get_gdal_config
        return fetch_config(option)
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    __main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 477, in <module>
        setup(**setup_kwargs)
      File "/env/lib/python3.7/site-packages/setuptools/__init__.py", line 165, in setup
        return distutils.core.setup(**attrs)
      File "/opt/python3.7/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/opt/python3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/opt/python3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/env/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 297, in run
        self.find_sources()
      File "/env/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 304, in find_sources
        mm.run()
      File "/env/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 535, in run
        self.add_defaults()
      File "/env/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 571, in add_defaults
        sdist.add_defaults(self)
      File "/opt/python3.7/lib/python3.7/distutils/command/sdist.py", line 228, in add_defaults
        self._add_defaults_ext()
      File "/opt/python3.7/lib/python3.7/distutils/command/sdist.py", line 311, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/opt/python3.7/lib/python3.7/distutils/cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/opt/python3.7/lib/python3.7/distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 320, in finalize_options
        self.gdaldir = self.get_gdal_config('prefix')
      File "/tmp/pip-install-4dzguh2n/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-4dzguh2n/GDAL/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/opt/python3.7/lib/python3.7/subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "/opt/python3.7/lib/python3.7/subprocess.py", line 1551, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config': '../../apps/gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 250, in get_gdal_config
        return fetch_config(option, gdal_config=self.gdal_config)
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config': '../../apps/gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/opt/python3.7/lib/python3.7/subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "/opt/python3.7/lib/python3.7/subprocess.py", line 1551, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 257, in get_gdal_config
        return fetch_config(option)
      File "/tmp/pip-install-4dzguh2n/GDAL/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    gdal_config_error: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config'
    
    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.
The command '/bin/sh -c pip install -r /app/requirements.txt' returned a non-zero code: 1
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1

In order to deploy the app I am running

gcloud app deploy

from a folder containing my app.yaml, main.py, requirements.txt, and Dockerfile. My app.yaml, requirements.txt, and Dockerfile can be found here: https://github.com/isodrosotherm/gcloud_gdal

bad_coder
  • 11,289
  • 20
  • 44
  • 72
JWB
  • 238
  • 1
  • 4
  • 12
  • I found this [community answer](https://stackoverflow.com/a/61407404/12857703) saying that this could be an issue with gdal itself and offers a few links to follow and a solution that dockerizes it with all the steps needed to bypass this issue, and finally try to deploy it to GAE Flex. Let me know if this helps. – Ralemos Jul 22 '20 at 14:14

1 Answers1

-2

file : dockerfile

FROM python:3.8.13-buster #by ubuntu only
RUN apt-get update && \
    apt-get install -y binutils libproj-dev gdal-bin ffmpeg libgdal-dev

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt

file : requirements.text

scikit-learn
geovoronoi
matplotlib
rasterio==1.2.0
affine==2.3.1
attrs==21.4.0
certifi==2022.6.15
click==7.1.2
click-plugins==1.1.1
cligj==0.7.2
Fiona==1.8.21
geopandas==0.11.0
munch==2.5.0
numpy==1.23.1
packaging==21.3
pandas==1.4.3
pyparsing==3.0.9
pyproj==3.3.1
python-dateutil==2.8.2
pytz==2022.1
Shapely==1.8.2
six==1.16.0
snuggs==1.4.7
kraivit
  • 1
  • 1
  • 1
    Welcome to Stack Overflow. Code is a lot more helpful when it is accompanied by an explanation. Stack Overflow is about learning, not providing snippets to blindly copy and paste. Please [edit] your answer and explain how it answers the specific question being asked. See [answer]. – ChrisGPT was on strike Jul 11 '22 at 22:47