datamade / how-to

📚 Doing all sorts of things, the DataMade way
MIT License
88 stars 12 forks source link

GDAL error when setting up GitHub Actions and CodeDeploy #166

Closed derekeder closed 3 years ago

derekeder commented 3 years ago

Description

In following the instructions on setting up GitHub Actions and CodeDeploy for Committee Oversight, I ran into a GDAL error.

It looks like the dependency is missing and I'm not sure where to add it. We include installing gdal-bin in the Dockerfile. Where's the equivalent place to add that for GitHub Actions?

Failed test/build: https://github.com/datamade/committee-oversight/pull/201/checks?check_run_id=1744741271

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.7.9/x64/bin/pytest", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/_pytest/config/__init__.py", line 59, in main
    config = _prepareconfig(args, plugins)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/_pytest/config/__init__.py", line 209, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/_pytest/helpconfig.py", line 89, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/_pytest/config/__init__.py", line 720, in pytest_cmdline_parse
    self.parse(args)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/_pytest/config/__init__.py", line 928, in parse
    self._preparse(args, addopts=addopts)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/_pytest/config/__init__.py", line 884, in _preparse
    early_config=self, args=args, parser=self._parser
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pytest_django/plugin.py", line 335, in pytest_load_initial_conftests
    _setup_django()
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pytest_django/plugin.py", line 223, in _setup_django
    django.setup()
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/apps/registry.py", line 112, in populate
    app_config.import_models()
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/runner/work/committee-oversight/committee-oversight/committeeoversightapp/models.py", line 14, in <module>
    from wagtail.core.models import Page
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/wagtail/core/models.py", line 8, in <module>
    from django.contrib.auth.models import Group, Permission
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
    class AbstractBaseUser(models.Model):
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/db/models/base.py", line 101, in __new__
    new_class.add_to_class('_meta', Options(meta, app_label))
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/db/models/base.py", line 305, in add_to_class
    value.contribute_to_class(cls, name)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/db/models/options.py", line 203, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/db/__init__.py", line 33, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/db/utils.py", line 202, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/db/utils.py", line 110, in load_backend
    return import_module('%s.base' % backend_name)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 6, in <module>
    from .features import DatabaseFeatures
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/db/backends/postgis/features.py", line 1, in <module>
    from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/db/backends/base/features.py", line 3, in <module>
    from django.contrib.gis.db.models import aggregates
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/db/models/__init__.py", line 3, in <module>
    import django.contrib.gis.db.models.functions  # NOQA
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/db/models/functions.py", line 4, in <module>
    from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/db/models/fields.py", line 3, in <module>
    from django.contrib.gis import forms, gdal
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/forms/__init__.py", line 3, in <module>
    from .fields import (  # NOQA
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/forms/fields.py", line 2, in <module>
    from django.contrib.gis.geos import GEOSException, GEOSGeometry
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/geos/__init__.py", line 5, in <module>
    from .collections import (  # NOQA
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/geos/collections.py", line 9, in <module>
    from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/geos/geometry.py", line 8, in <module>
    from django.contrib.gis import gdal
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/gdal/__init__.py", line 28, in <module>
    from django.contrib.gis.gdal.datasource import DataSource
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/gdal/datasource.py", line 39, in <module>
    from django.contrib.gis.gdal.driver import Driver
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
    from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
    from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/django/contrib/gis/gdal/libgdal.py", line 43, in <module>
    % '", "'.join(lib_names)
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.
Error: Process completed with exit code 1.
hancush commented 3 years ago

Voila: https://github.com/datamade/committee-oversight/pull/201/commits/4fbb41cfcf0fb00253f24950d01a02ce092737a9