[Django] #28178: django.contrib.gis.gdal.error.GDALException after update to Django 1.11.1

29 views
Skip to first unread message

Django

unread,
May 7, 2017, 7:35:32 AM5/7/17
to django-...@googlegroups.com
#28178: django.contrib.gis.gdal.error.GDALException after update to Django 1.11.1
-----------------------------------------+-------------------------------
Reporter: Bas ten Berge | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Keywords: update 1.11.1
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+-------------------------------
I just updated Django 1.11 to 1.11.1 to learn my project would not start
without changes to the settings. runserver stops with this message:
{{{
django.contrib.gis.gdal.error.GDALException: Could not find the GDAL
library (tried "gdal", "GDAL", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0",
"gdal1.8.0", "gdal1.7.0"). Try setting GDAL_LIBRARY_PATH in your settings.
}}}

My installed apps:
{{{
...
DJANGO_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.humanize',
)

THIRD_PARTY_APPS = (
'allauth',
'mailer',
'taggit',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.linkedin_oauth2',
'tastypie',
'avatar',
'reversion',
'oauth2_provider',
'channels',
'compressor',
'debug_toolbar', # django-debug-toolbar
)

BROWNPAPERSESSION_APPS = (
'app',
'invite',
'apporg',
'session',
'topic',
)

INSTALLED_APPS = \
DJANGO_APPS + THIRD_PARTY_APPS + BROWNPAPERSESSION_APPS

...
}}}

I could find a reference in the docs at
https://docs.djangoproject.com/en/1.11/releases/1.11.1/:
> Prevented hiding GDAL errors if it’s not installed when using
contrib.gis (#28160). (It’s a required dependency as of Django 1.11.)

... but I didn't have the issue when I was running Django 1.11. I did not
expect such a dependency change in a minor version update. How can I
disable GIS?

--
Ticket URL: <https://code.djangoproject.com/ticket/28178>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 7, 2017, 11:38:59 AM5/7/17
to django-...@googlegroups.com
#28178: django.contrib.gis.gdal.error.GDALException after update to Django 1.11.1
-------------------------------+--------------------------------------

Reporter: Bas ten Berge | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution:

Keywords: update 1.11.1 | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Tim Graham):

Can you please post the complete traceback so we can see what's importing
`django.contrib.gis`?

--
Ticket URL: <https://code.djangoproject.com/ticket/28178#comment:1>

Django

unread,
May 7, 2017, 11:50:50 AM5/7/17
to django-...@googlegroups.com
#28178: django.contrib.gis.gdal.error.GDALException after update to Django 1.11.1
-------------------------------+--------------------------------------

Reporter: Bas ten Berge | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution:

Keywords: update 1.11.1 | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Bas ten Berge):

Sure!
{{{
Performing system checks...

Unhandled exception in thread started by <function wrapper at 0x5d38230>
Traceback (most recent call last):
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/channels/management/commands/runserver.py", line 47, in inner_run
self.check(display_num_errors=True)
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in
import_module
__import__(name)
File
"/var/www/brownpapersession/dev/brownpapersession/brownpapersession/urls.py",
line 16, in <module>
from tastypie.api import Api, NamespacedApi
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-packages/tastypie/api.py", line
11, in <module>
from tastypie.resources import Resource
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/tastypie/resources.py", line 24, in <module>
from django.contrib.gis.db.models.fields import GeometryField
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/contrib/gis/db/models/__init__.py", line 3, in <module>
from django.contrib.gis.db.models.aggregates import * # NOQA
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/contrib/gis/db/models/aggregates.py", line 1, in <module>
from django.contrib.gis.db.models.fields import ExtentField
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/contrib/gis/db/models/fields.py", line 3, in <module>
from django.contrib.gis import forms, gdal
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/contrib/gis/forms/__init__.py", line 3, in <module>
from .fields import ( # NOQA
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/contrib/gis/forms/fields.py", line 4, in <module>
from django.contrib.gis.geos import GEOSException, GEOSGeometry
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/contrib/gis/geos/__init__.py", line 5, in <module>
from .collections import ( # NOQA
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/contrib/gis/geos/collections.py", line 11, in <module>
from django.contrib.gis.geos.geometry import GEOSGeometry,
LinearGeometryMixin
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/contrib/gis/geos/geometry.py", line 11, in <module>
from django.contrib.gis import gdal
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/contrib/gis/gdal/__init__.py", line 28, in <module>
from django.contrib.gis.gdal.datasource import DataSource
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/contrib/gis/gdal/datasource.py", line 39, in <module>
from django.contrib.gis.gdal.driver import Driver
File "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.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 "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.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 "/var/www/brownpapersession/dev/env-
brownpapersession/local/lib/python2.7/site-
packages/django/contrib/gis/gdal/libgdal.py", line 44, in <module>
'GDAL_LIBRARY_PATH in your settings.' % '", "'.join(lib_names)


django.contrib.gis.gdal.error.GDALException: Could not find the GDAL
library (tried "gdal", "GDAL", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0",
"gdal1.8.0", "gdal1.7.0"). Try setting GDAL_LIBRARY_PATH in your settings.

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28178#comment:2>

Django

unread,
May 7, 2017, 11:51:36 AM5/7/17
to django-...@googlegroups.com
#28178: django.contrib.gis.gdal.error.GDALException after update to Django 1.11.1
-------------------------------+--------------------------------------

Reporter: Bas ten Berge | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution:

Keywords: update 1.11.1 | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Bas ten Berge):

Looks like django-tastypie needs it, right?

--
Ticket URL: <https://code.djangoproject.com/ticket/28178#comment:3>

Django

unread,
May 7, 2017, 12:59:54 PM5/7/17
to django-...@googlegroups.com
#28178: Allow applications that make optional use of contrib.gis to better silence
the lack of a GDAL install
--------------------------------------+------------------------------------

Reporter: Bas ten Berge | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: update 1.11.1 | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* type: Uncategorized => Cleanup/optimization
* component: Uncategorized => GIS
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


Comment:

I would say that tastypie [https://github.com/django-tastyypie/django-
tastypie/blob/72ff598eb654e0fb61ae525f8804808ff35aafdd/tastypie/resources.py#L23-L26
should catch] `GDALException`, however, that exception isn't importable
without GDAL installed! So, we might consider some change to Django to
alleviate this -- perhaps `ImproperlyConfigured` could be raised here
instead of `GDALException`.

--
Ticket URL: <https://code.djangoproject.com/ticket/28178#comment:4>

Django

unread,
May 7, 2017, 3:55:03 PM5/7/17
to django-...@googlegroups.com
#28178: Allow applications that make optional use of contrib.gis to better silence
the lack of a GDAL install
--------------------------------------+------------------------------------
Reporter: Bas ten Berge | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: update 1.11.1 | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Claude Paroz):

+1 to raise `ImproperlyConfigured` at this location.

--
Ticket URL: <https://code.djangoproject.com/ticket/28178#comment:5>

Django

unread,
May 7, 2017, 4:20:48 PM5/7/17
to django-...@googlegroups.com
#28178: Allow applications that make optional use of contrib.gis to better silence
the lack of a GDAL install
--------------------------------------+------------------------------------
Reporter: Bas ten Berge | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: update 1.11.1 | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Bas ten Berge):

Thanks for working on the issue and your time looking into the issue, as
opposed to myself :flushed:

The name `ImproperlyConfigured` suggests the option is available as a
configuration option. In my understanding, it's not possible to disable
(or enable) gis via `settings`, as an individual setting. Right?

For anyone else looking into this issue: I changed the `except` statement
on line 25 of `tastypie/resources.py` to get the project running on the
Django 1.11.1:
{{{
except (ImproperlyConfigured, ImportError, Exception, ): # Exception is a
workaround for GDALException
}}}

Could've just used `Exception` there...

--
Ticket URL: <https://code.djangoproject.com/ticket/28178#comment:6>

Django

unread,
May 8, 2017, 10:18:24 AM5/8/17
to django-...@googlegroups.com
#28178: Allow applications that make optional use of contrib.gis to better silence
the lack of a GDAL install
--------------------------------------+------------------------------------
Reporter: Bas ten Berge | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: update 1.11.1 | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/8473 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/28178#comment:7>

Django

unread,
May 8, 2017, 12:26:12 PM5/8/17
to django-...@googlegroups.com
#28178: Allow applications that make optional use of contrib.gis to better silence
the lack of a GDAL install
--------------------------------------+------------------------------------
Reporter: Bas ten Berge | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: GIS | Version: 1.11
Severity: Release blocker | Resolution: fixed
Keywords: update 1.11.1 | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"c2975910a5bc2729c2de01eb5b84777fa59551e1" c2975910]:
{{{
#!CommitTicketReference repository=""
revision="c2975910a5bc2729c2de01eb5b84777fa59551e1"
Fixed #28178 -- Changed contrib.gis to raise ImproperlyConfigured if gdal
isn't installed.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28178#comment:8>

Django

unread,
May 8, 2017, 12:37:46 PM5/8/17
to django-...@googlegroups.com
#28178: Allow applications that make optional use of contrib.gis to better silence
the lack of a GDAL install
--------------------------------------+------------------------------------
Reporter: Bas ten Berge | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: GIS | Version: 1.11
Severity: Release blocker | Resolution: fixed
Keywords: update 1.11.1 | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"b3e56da05061c75755475651fd57a10314e952a7" b3e56da0]:
{{{
#!CommitTicketReference repository=""
revision="b3e56da05061c75755475651fd57a10314e952a7"
[1.11.x] Fixed #28178 -- Changed contrib.gis to raise ImproperlyConfigured


if gdal isn't installed.

Backport of c2975910a5bc2729c2de01eb5b84777fa59551e1 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28178#comment:9>

Reply all
Reply to author
Forward
0 new messages