Django: "django.contrib.gis.gdal.prototypes.ds" crashes with "attributeerror: symbol not found"

Viewed 297

Running the latest Django (3.0.4) I am now getting this:

  File "[...]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 "[...]site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 71, in <module>
    get_field_as_integer64 = int64_output(lgdal.OGR_F_GetFieldAsInteger64, [c_void_p, c_int])
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ctypes/__init__.py", line 361, in __getattr__
    func = self.__getitem__(name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ctypes/__init__.py", line 366, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(0x101667060, OGR_F_GetFieldAsInteger64): symbol not found

My Observations:

I have [ellided] the path names which refer to Django in my virtual-environment. I observe that the module that is actually crashing is in /Library/Frameworks/Python.framework/ ... this on Macintosh OS/X Catalina.

The version of Python that is installed on this computer is 3.6.4. (The version on the hosting service is considerably older ... 3.4.)

Is this, as I suspect, a problem with the Python installation on this computer? (The most recent version that can be installed here is 3.7.7.)


EDIT: NO, it isn't!

After installing Django 3.0.4 on a Linux host I got this:

 AttributeError: /usr/local/lib/libgdal.so.1: undefined symbol: OGR_F_GetFieldAsInteger64

Now, once again this is a system-wide library that's being called, but I now suspect that the root cause problem is actually in this line:

   File "[...]/lib/python3.6/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 71, in <module>
get_field_as_integer64 = int64_output(lgdal.OGR_F_GetFieldAsInteger64, [c_void_p, c_int])

I am now rolling Django versions backward to see if I can make the problem go away and if so "answer my own question."

1 Answers

I had to walk back all the way to Django 2.1 before the problem finally went away.

libgdal version 1.6 is installed on this computer's virtual-environment and I don't know if it is practical nor possible for me to change it. ("gcc" is installed here, "configure" is not.)

Related