1 year ago

#367322

test-img

Kaleab Woldemariam

GDAL dll points to old python

I am trying to use gdal from Christopher Gohlke's site and apparently, the path to the gdal303.dll is set in old Python3.9 while I am currently using Python3.10, and throws FilNotFoundError. The stack trace looks like:

Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
    autoreload.raise_last_exception()
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 398, in execute
    autoreload.check_errors(django.setup)()
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\apps\registry.py", line 116, in populate
    app_config.import_models()
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\apps\config.py", line 304, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\auth\models.py", line 3, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\auth\base_user.py", line 49, in <module>
    class AbstractBaseUser(models.Model):
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\models\base.py", line 141, in __new__
    new_class.add_to_class("_meta", Options(meta, app_label))
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\models\base.py", line 369, in add_to_class
    value.contribute_to_class(cls, name)
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\models\options.py", line 235, in contribute_to_class
    self.db_table, connection.ops.max_name_length()
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\connection.py", line 15, in __getattr__
    return getattr(self._connections[self._alias], item)
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\connection.py", line 62, in __getitem__
    conn = self.create_connection(alias)
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\utils.py", line 208, in create_connection
    backend = load_backend(db["ENGINE"])
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\utils.py", line 113, in load_backend
    return import_module("%s.base" % backend_name)
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\db\backends\postgis\base.py", line 6, in <module>
    from .features import DatabaseFeatures
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\db\backends\postgis\features.py", line 1, in <module>
    from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\db\backends\base\features.py", line 3, in <module>
    from django.contrib.gis.db import models
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\db\models\__init__.py", line 3, in <module>
    import django.contrib.gis.db.models.functions  # NOQA
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\db\models\functions.py", line 3, in <module>
    from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\db\models\fields.py", line 3, in <module>
    from django.contrib.gis import forms, gdal
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\forms\__init__.py", line 3, in <module>
    from .fields import (  # NOQA
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\forms\fields.py", line 2, in <module>
    from django.contrib.gis.gdal import GDALException
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\gdal\__init__.py", line 28, in <module>
    from django.contrib.gis.gdal.datasource import DataSource
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\gdal\datasource.py", line 40, in <module>
    from django.contrib.gis.gdal.driver import Driver
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\gdal\driver.py", line 5, in <module>
    from django.contrib.gis.gdal.prototypes import ds as vcapi
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\gdal\prototypes\ds.py", line 9, in <module>
    from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\gis\gdal\libgdal.py", line 69, in <module>
    lgdal = CDLL(lib_path)
  File "C:\Users\E6400\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Python39\Lib\site-packages\osgeo\gdal304.dll' (or one of its dependencies). Try using the full path with const
ructor syntax.

python

gdal

0 Answers

Your Answer

Accepted video resources