1

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

nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
asked Oct 24, 2017 at 16:14
1

1 Answer 1

2

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',)]
answered Oct 24, 2017 at 17:21
2
  • 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. Commented Oct 24, 2017 at 22:34
  • Look at Pyspatialite installation error on MacOSX (QGIS plugin) Commented Oct 25, 2017 at 16:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.