Deploying Python Web App that requires GDAL to Azure App Services fails

Granada, Luis 5 Reputation points
2023-06-14T10:13:26.42+00:00

Hello,

I'm trying to deploy a web app built with Python and Dash (Flask) to Azure App Services. This web app requires GDAL to work. When I try to deploy via VS Code I get the errors shown below. Can anyone help please?


11:52:28 AM test-gen-abc: [09:52:19+0000] Collecting GDAL==3.7.0
11:52:28 AM test-gen-abc: [09:52:19+0000]   Downloading GDAL-3.7.0.tar.gz (775 kB)
11:52:28 AM test-gen-abc: [09:52:19+0000]      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 775.5/775.5 kB 1.9 MB/s eta 0:00:00
11:52:28 AM test-gen-abc: [09:52:19+0000]   Preparing metadata (setup.py): started
11:52:28 AM test-gen-abc: [09:52:20+0000]   Preparing metadata (setup.py): finished with status 'error'
11:52:28 AM test-gen-abc:   error: subprocess-exited-with-error
11:52:28 AM test-gen-abc:   
11:52:28 AM test-gen-abc:   × python setup.py egg_info did not run successfully.
11:52:28 AM test-gen-abc:   │ exit code: 1
11:52:28 AM test-gen-abc:   ╰─> [94 lines of output]
11:52:28 AM test-gen-abc:       WARNING: numpy not available!  Array support will not be enabled
11:52:28 AM test-gen-abc:       running egg_info
11:52:28 AM test-gen-abc:       creating /tmp/pip-pip-egg-info-dh67mqbk/GDAL.egg-info
11:52:28 AM test-gen-abc:       writing /tmp/pip-pip-egg-info-dh67mqbk/GDAL.egg-info/PKG-INFO
11:52:28 AM test-gen-abc:       writing dependency_links to /tmp/pip-pip-egg-info-dh67mqbk/GDAL.egg-info/dependency_links.txt
11:52:28 AM test-gen-abc:       writing requirements to /tmp/pip-pip-egg-info-dh67mqbk/GDAL.egg-info/requires.txt
11:52:29 AM test-gen-abc:       writing top-level names to /tmp/pip-pip-egg-info-dh67mqbk/GDAL.egg-info/top_level.txt
11:52:29 AM test-gen-abc:       writing manifest file '/tmp/pip-pip-egg-info-dh67mqbk/GDAL.egg-info/SOURCES.txt'
11:52:29 AM test-gen-abc:       Traceback (most recent call last):
11:52:29 AM test-gen-abc:         File "/tmp/pip-install-2ai2grh7/gdal_5f36f7946f2c49f5a3622e4d2208607b/setup.py", line 87, in fetch_config
11:52:29 AM test-gen-abc:           p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
11:52:29 AM test-gen-abc:               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11:52:29 AM test-gen-abc:         File "/tmp/oryx/platforms/python/3.11.0/lib/python3.11/subprocess.py", line 1022, in __init__
11:52:29 AM test-gen-abc:           self._execute_child(args, executable, preexec_fn, close_fds,
11:52:29 AM test-gen-abc:         File "/tmp/oryx/platforms/python/3.11.0/lib/python3.11/subprocess.py", line 1899, in _execute_child
11:52:29 AM test-gen-abc:           raise child_exception_type(errno_num, err_msg, err_filename)
11:52:29 AM test-gen-abc:       FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
11:52:29 AM test-gen-abc:       
11:52:29 AM test-gen-abc:       During handling of the above exception, another exception occurred:
11:52:29 AM test-gen-abc:       
11:52:29 AM test-gen-abc:       Traceback (most recent call last):
11:52:29 AM test-gen-abc:         File "/tmp/pip-install-2ai2grh7/gdal_5f36f7946f2c49f5a3622e4d2208607b/setup.py", line 188, in get_gdal_config
11:52:29 AM test-gen-abc:           return fetch_config(option, gdal_config=self.gdal_config)
11:52:29 AM test-gen-abc:                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11:52:29 AM test-gen-abc:         File "/tmp/pip-install-2ai2grh7/gdal_5f36f7946f2c49f5a3622e4d2208607b/setup.py", line 90, in fetch_config
11:52:29 AM test-gen-abc:           raise gdal_config_error(e)
11:52:29 AM test-gen-abc:       gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
11:52:29 AM test-gen-abc:       
11:52:29 AM test-gen-abc:       During handling of the above exception, another exception occurred:
11:52:29 AM test-gen-abc:       
11:52:29 AM test-gen-abc:       Traceback (most recent call last):
11:52:29 AM test-gen-abc:         File "
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Granada, Luis 5 Reputation points
    2023-07-06T06:43:21.0266667+00:00

    I have solved the problem for now by installing a custom GDAL wheel for Linux since the web app is installed on Linux. In the requirements.txt file, I replaced:

    GDAL==3.7.0
    

    with

    ./wheelhouse/GDAL-3.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
    

    And then stored the file "GDAL-3.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl" in a folder called "wheelhouse" inside the project.

    It works.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.