Notes:
Using Django 4.0.5, and Python 3.10
IDE: Pycharm Professional
OSGEO4W version: 2 (https://download.osgeo.org/osgeo4w/v2/)
Problem
I cant get the gis library to work in Django. I followed the documentation: https://docs.djangoproject.com/en/4.0/ref/contrib/gis/install/#windows. Having followed these steps I get this error:
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal303", "gdal302", "gdal301", "gdal300", "gdal204", "gdal203", "gdal202", "gdal201", "gdal20")
I then looked into what version of GDAL, that OSGEO4W had installed and found it to be gdal305. So I went in on https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal, where I downloaded the wheel, for my version of python, (GDAL-3.3.3-cp310-cp310-win_amd64.whl) and used the command pip install GDAL-3.3.3-cp310-cp310-win_amd64.whl
. I then changed the path variables to go for this version of gdal rather then the one installed with OSgeo4W. I then got the following error:
OSError: [WinError 127] : The specified procedure could not be found
After reading online, I found the following stackoverflow: OSError in Geodjango: [WinError 127] : The specified procedure could not be found
However, did this not work for me, I still get the same errors (depending on where i set the gdal path).
Other things i tried:
I tried to use an earlier version of OSgeo4W, but the installer did not have any available download sites.
I tried using anaconda instead of pycharm venv, and downloading gdal, proj, geos through conda-forge.
If more information is needed please let me know. First time writing on stackoverflow.