question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not find the GDAL library

See original GitHub issue

I followed the installation instructions and got the following error.

I’m on Python 3.5 and Django 1.11.4

Any clue what could be going on or how to fix this?

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x10793a950>
Traceback (most recent call last):
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    autoreload.raise_last_exception()
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/utils/autoreload.py", line 251, in raise_last_exception
    six.reraise(*_exception)
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/apps/config.py", line 94, in create
    module = import_module(entry)
  File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/mapwidgets/__init__.py", line 4, in <module>
    from .widgets import GooglePointFieldWidget, GooglePointFieldInlineWidget, \
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/mapwidgets/widgets.py", line 4, in <module>
    from django.contrib.gis.forms import BaseGeometryWidget
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/contrib/gis/forms/__init__.py", line 3, in <module>
    from .fields import (  # NOQA
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/contrib/gis/forms/fields.py", line 4, in <module>
    from django.contrib.gis.geos import GEOSException, GEOSGeometry
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/contrib/gis/geos/__init__.py", line 5, in <module>
    from .collections import (  # NOQA
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/contrib/gis/geos/collections.py", line 11, in <module>
    from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/contrib/gis/geos/geometry.py", line 11, in <module>
    from django.contrib.gis import gdal
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/contrib/gis/gdal/__init__.py", line 28, in <module>
    from django.contrib.gis.gdal.datasource import DataSource
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/contrib/gis/gdal/datasource.py", line 39, in <module>
    from django.contrib.gis.gdal.driver import Driver
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/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 "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
    from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
  File "/Users/santiago/Programming/comedydir/myvenv/lib/python3.5/site-packages/django/contrib/gis/gdal/libgdal.py", line 45, in <module>
    % '", "'.join(lib_names)
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
sangel10commented, Sep 5, 2017

For anyone else having the same problems, the solution here worked for me: https://www.alextomkins.com/2017/08/fixing-gdal-geos-django-macos/

The solution was to uninstall GDAL with homebrew and instead install it from here: http://www.kyngchaos.com/software/frameworks

Then update the necessary environment variables

2reactions
abdalwhabSalahaldeencommented, Nov 3, 2018

i have this problem and ican’t start with geo django help mee

Read more comments on GitHub >

github_iconTop Results From Across the Web

GeoDjango on Windows: "Could not find the GDAL library ...
I have found the following to work for windows: Run python to check if your python is 32 or 64 bit. Install corresponding...
Read more >
GeoDjango can't find GDAL - GIS Stack Exchange
But it seems like Django can't find the gdal module. I have gdal installed by pip using the wheels in https://www.lfd.uci.edu/~gohlke/pythonlibs ...
Read more >
Installing Geospatial libraries - Django documentation
Can't find GDAL library¶. When GeoDjango can't find the GDAL library, configure your Library environment settings or set GDAL_LIBRARY_PATH in your settings.
Read more >
Geodjango Error - Google Groups
But the problem is with GDAL library. Earlier there was an error showing :- django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library ...
Read more >
"Could not find the GDAL library" / "OSError: [WinError 126 ...
Django : GeoDjango on Windows: " Could not find the GDAL library " / "OSError: [WinError 126] The specified module could not be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found