title: GeoDjango on Windows: "Could not find the GDAL library" / "OSError: [WinError 126] The specified module could not be found"
body: <p>I've been trying to setup my windows computer such that I can have a local postgreSQL with PostGIS extension. With this installed I hope to be able to create a project with geodjango locally before putting it in the cloud. I have been working with Django for a little while now on my local machine with the SQLite DB, but since the next project will partly be based on coordinate based data I wanted to setup the right environment.</p>
  
  <p><strong>Import note: I've installed mini-conda to run in a seperate environment. I do activate this environment "development" when I work though</strong></p>
  
  <p>I've tried to follow most of the geodjango information/tutorials online, but can't get it to work. What I've done (mostly followed this: <a href="https://docs.djangoproject.com/en/2.0/ref/contrib/gis/install/#windows" rel="noreferrer">https://docs.djangoproject.com/en/2.0/ref/contrib/gis/install/#windows</a>):</p>
  
  <ol>
  <li>Download and install the latest (10.3) PostgreSQL setup from <a href="https://www.enterprisedb.com/downloads/postgres-postgresql-downloads" rel="noreferrer">https://www.enterprisedb.com/downloads/postgres-postgresql-downloads</a></li>
  <li>After installation I also installed used the Application Stack Builder to install PostGis</li>
  <li>I've installed OSGeo4W from <a href="https://trac.osgeo.org/osgeo4w/" rel="noreferrer">https://trac.osgeo.org/osgeo4w/</a></li>
  <li>I've created a batch script as described on the geodjango website (<a href="https://docs.djangoproject.com/en/2.0/ref/contrib/gis/install/#windows" rel="noreferrer">https://docs.djangoproject.com/en/2.0/ref/contrib/gis/install/#windows</a>) and ran it as administrator (except for the part where it sets the path to python, cause python was already in there since I've been using python for a while now)</li>
  <li>I've tried some command in psql shell and I think I've created a database with name: geodjango, username: **** and pass: ****.</li>
  <li>I don't know if I have given the geodjango user all priveleges, but I suspect so.</li>
  </ol>
  
  <p>After all of this I created a new django project and in settings.py I've added some parts:</p>
  
  <pre><code>INSTALLED_APPS = [
  'django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles',
  'django.contrib.gis',
  'nameOfMyApp',
  ]
  </code></pre>
  
  <p>I've also got this in settings.py:</p>
  
  <pre><code>DATABASES = {
  'default': {
      'ENGINE': 'django.contrib.gis.db.backends.postgis',
      'NAME': 'geodjango',
      'USER': '****',
      'PASSWORD': '****',
      'HOST': 'localhost',
  }
  }
  
  # FOR GEODJANGO
  POSTGIS_VERSION = (2, 4, 3)
  </code></pre>
  
  <p>When I try to set up the database in django I run (in the right folder):</p>
  
  <pre><code>python manage.py makemigrations
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal202", "gdal201", "gdal20", "gdal111", "gdal110", "gdal19"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.
  </code></pre>
  
  <p>I've tried to fix that, but nothing seems to work.
  Can anybody give me some help in setting this all up locally?</p>
  
  <p>Update 7-3-2018:</p>
  
  <ul>
  <li>I've tried installing GDAL manually myself, (from: <a href="http://www.gisinternals.com/query.html?content=filelist&amp;file=release-1911-x64-gdal-2-2-3-mapserver-7-0-7.zip" rel="noreferrer">http://www.gisinternals.com/query.html?content=filelist&amp;file=release-1911-x64-gdal-2-2-3-mapserver-7-0-7.zip</a> the generic core components)</li>
  <li>I've installed (what I assume are) the python bindings from <a href="https://www.lfd.uci.edu/~gohlke/pythonlibs/" rel="noreferrer">https://www.lfd.uci.edu/~gohlke/pythonlibs/</a>. Still I get the same error. </li>
  <li>I've also tried setting the GDAL_LIBRARY_PATH to the GDAL directory or the gdal-data directory (which resides in the GDAL directory).</li>
  </ul>
  
  <p>Now I get the following error:</p>
  
  <pre><code>OSError: [WinError 126] The specified module could not be found
  </code></pre>
  
  <p>(while the .dll is there...)</p>