Trouble installing GeoDjango with spatialite on Python3

401 views
Skip to first unread message

Antonis Christofides

unread,
May 24, 2017, 2:27:22 AM5/24/17
to django...@googlegroups.com

Hi,

This is the error message I get when I run "./manage.py test" or "./manage.py migrate":

  File "/home/anthony/nosync/virtualenvs/enhydris3.6/lib/python3.6/site-packages/django/contrib/gis/db/backends/spatialite/base.py", line 53, in get_new_connection                          
    'The pysqlite library does not support C extension loading. '
django.core.exceptions.ImproperlyConfigured: The pysqlite library does not support C extension loading. Both SQLite and pysqlite must be configured to allow the loading of extensions to use SpatiaLite.

However, something isn't right. AFAIU pysqlite isn't supported on Python 3, therefore something else is happening. This is a Python 3.6 that I installed on Debian stretch. These are the relevant settings:

DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.spatialite',
        'NAME': 'enhydris.db',
    }
}
if os.path.exists('/usr/lib/x86_64-linux-gnu/mod_spatialite.so'):
    # This is necessary for spatialite>=4.2
    SPATIALITE_LIBRARY_PATH = 'mod_spatialite'

Thanks!

A.

-- 
Antonis Christofides
http://djangodeployment.com

Tim Graham

unread,
May 24, 2017, 11:14:36 AM5/24/17
to Django users
Did you compile Python from source? If so, you need to use this option: ./configure --enable-loadable-sqlite-extensions before running "make install".

Bugra Demiriz

unread,
May 5, 2020, 8:53:43 AM5/5/20
to Django users
Did you solve this problem?


24 Mayıs 2017 Çarşamba 09:27:22 UTC+3 tarihinde Antonis Christofides yazdı:
Reply all
Reply to author
Forward
0 new messages