Hello, I’m trying to work with GeoDjango version 5.1 on Windows.When I try to run the command to create a migration, it shows:
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried “gdal308”, “gdal307”, “gdal306”, “gdal305”, “gdal304”, “gdal303”, “gdal302”, “gdal301”, “gdal300”). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.
I installed OSGeo4W-setup.exe, but it installs the gdal309 version. I can’t install GDAL 308.
I am facing the same issue.
Have you found out any solution?
Give these steps a try; they worked for me.
-
Install gdal in your pc.
-
Cofigure gdal in the setting.py file by adding the .dll path
-
In the installed apps, add ‘django.contrib.gis’
Hello people. I have tried most of the solutions provided here and in stack overflow. But most seem not to work. Then I decided to try the good old tutorial search way and I found this
My installation did not automatically add to path but I did it manually and it works now.
Then I tried “gdalinfo --version” on powershell, not cmd, it revealed the version successfully. If the installation works, but not available in cmd/vscode terminal, copy the following to your vscode settings to configure it to work on the vscode terminal
"terminal.integrated.env.windows": {
"Path": "C:\\OSGeo4W\\bin;${env:Path}"
}
That is my path, use the one relative to you.
Also in your wsgi file, add the following line
os.environ['GDAL_LIBRARY_PATH'] = r"C:/OSGeo4W/bin/gdal310.dll"
1 Like
This works as explained, thanks