I am trying to use Midvatten on QGIS 2.18.13 on a mac. When I create a new database, I get
"no such function: spatialite_version" (see error message below).
I've uninstalled and reinstalled QGIS (using Kyngchaos's packages) and Midvatten. None of that has helped.
How do I get this basic spatialite function working?
Traceback (most recent call last):
File "/Users/Becca/.qgis2/python/plugins/midvatten/midvatten.py", line 853, in new_db newdbinstance = newdb(verno)
File "/Users/Becca/.qgis2/python/plugins/midvatten/tools/create_db.py", line 41, in init self.create_new_db(verno,user_select_CRS,EPSG_code, delete_srids) #CreateNewDB(verno)
File "/Users/Becca/.qgis2/python/plugins/midvatten/tools/create_db.py", line 82, in create_new_db versionstext = self.cur.execute('select spatialite_version()').fetchall()
OperationalError: no such function: spatialite_version
-
1would contact the plugin maintainer github.com/jkall/qgis-midvatten-plugin/blob/master/midvatten.pyMapperz– Mapperz ♦2017年10月24日 16:44:43 +00:00Commented Oct 24, 2017 at 16:44
1 Answer 1
Have you installed the KyngChaos SQLite Framework ?
It contains Spatialite and pyspatialite
In Python
import pyspatialite
# location of the pyspatialite module
pyspatialite.__file__
'/Library/Frameworks/SQLite3.framework/Versions/C/Python/2.7/pyspatialite/__init__.pyc'
The error comes from the line 82 of your create_db.py file (versionstext = self.cur.execute('select spatialite_version()').fetchall(): OperationalError: no such function: spatialite_version
) and with a correct installation, it works without problem.
from pyspatialite import dbapi2 as sqlite # line 30
conn = sqlite.connect("Midv.sqlite")
cur = conn.cursor()
print cur.execute('select spatialite_version()').fetchall() #line 82
[(u'4.3.0a',)]
-
I am using the Kyngchaos Sqlite Framework. The pyspatialite file is in the right place but still I get the no such function: spatialite_version error. I tried to just set the version in create_db.py but then got a series of errors about not being able to create some (but not all) of the standard tables.Becca– Becca2017年10月24日 22:34:30 +00:00Commented Oct 24, 2017 at 22:34
-
Look at Pyspatialite installation error on MacOSX (QGIS plugin)gene– gene2017年10月25日 16:04:05 +00:00Commented Oct 25, 2017 at 16:04