Home:ALL Converter>GDAL will not install into a GitHub Actions Ubuntu venv

GDAL will not install into a GitHub Actions Ubuntu venv

Ask Time:2021-07-06T03:52:34         Author:Zach Tait

Json Formatter

My .yml code is shown below that tests every pull request created for the repo on Git.

  name: Python Linux application
  
  on:
    pull_request:
      branches: [ '**' ]
  
  jobs:
    build:
  
      runs-on: ubuntu-latest
  
      steps:
        - uses: actions/checkout@v2
        - name: Set up Python 3.9
          uses: actions/setup-python@v2
          with:
            python-version: 3.9
        - name: Install dependencies
          run: |
            python -m pip install --upgrade pip
            sudo apt-get install libproj-dev proj-data proj-bin
            sudo apt-get install libgeos-dev
            sudo apt-get install gdal-bin libgdal-dev libgdal-doc
            pip install wheel
            pip install flake8 pytest Cython numpy proj geos GDAL==3.2.3
            if [ -f requirements-linux.txt ]; then pip install -r requirements-linux.txt; fi
        - name: Lint with flake8
          run: |
            # stop the build if there are Python syntax errors or undefined names
            flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
            # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
            flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
        - name: Test with pytest
          run: |
            pytest

After several thousand (11390) lines of error code, this is the final error:

error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /opt/hostedtoolcache/Python/3.9.5/x64/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rkrb3fqi/gdal_c6b10766da894ef6b4738e8ab6e2acd7/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rkrb3fqi/gdal_c6b10766da894ef6b4738e8ab6e2acd7/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-9qjem06l/install-record.txt --single-version-externally-managed --compile --install-headers /opt/hostedtoolcache/Python/3.9.5/x64/include/python3.9/GDAL Check the logs for full command output.

I've tried installing every header I can find to do with GDAL and nothing seems to work.

Author:Zach Tait,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/68261477/gdal-will-not-install-into-a-github-actions-ubuntu-venv
yy