ptrv / gpx2spatialite

GNU General Public License v3.0
23 stars 8 forks source link

Unable to load spatialite sqlite3 extension #25

Closed johnjohndoe closed 8 years ago

johnjohndoe commented 8 years ago

I installed gpx2spatialite v.0.8.0 on Ubuntu 15.10 via pip into user scope:

$ pip install gpx2spatialite --user

To import data I run the following command:

$ gpx2spatialite import -d test.sqlite -u TestUser ../testdata

This fails with the following error message:

Unable to load spatialite sqlite3 extension

Problem solving approach

I followed your recommendation on how to satisfy dependencies by enabling loading extensions for pysqlite-2.6.3.tar.gz which I found described in .travis.yml as well. One difference from your setup is that I choose to install into user scope as in python setup.py install --user resp. pip install . --user. After this I uninstalled and installed gpx2spatialite once again. However, the whole setup has no effect - the error stays.

Can you please tell me where I can investigate further to solve this problem?

ptrv commented 8 years ago

After you installed pysqlite, can you successfully run this command in the python shell?

from pysqlite2 import dbapi2 as spatialite
hasattr(spatialite.Connection, 'enable_load_extension')

Do you have already some other python sqlite libarary on your system, which may interfere with your local install? Is your user folder in the path? Can the interpreter find the libraries?

You can see your path with:

import sys
for p in sys.path:
  print(p)
ptrv commented 8 years ago

Btw, are you using python 2?

johnjohndoe commented 8 years ago
ptrv commented 8 years ago

The issue here is, that for some reason the extension cannot be loaded even the sqlite3 library supports loading extensions. And in case we have pyspatialite installed, it never gets loaded because our sqlite3 library supports loading extensions a we prioritize it in favor of pyspatialite.