Windows: Correct way to initialize spatialite?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 172
- Avg merge
- 9m
- Merged PRs (30d)
- 1
Description
Hi there.
I am struggling to find a way to install, or to make the library type out a string, when I type db.find_spatialite() according to the documentation. Instead it prints out None, which means that SpatiaLite is not found.
My code is this:
from sqlite_utils import Database
from sqlite_utils.utils import find_spatialite
modelDb = Database('..\\modeludtraek.sqlite')
modelDb.init_spatialite(find_spatialite())
This gives me: TypeError: load_extension() argument must be str, not None.
Obviously, I have not installed the SpatiaLite extension... and I have no clue how to do that. The documentation links to this page. Thus, I don't know what to download and where to place the files. I believe I should look for a file called mod_spatialite.dylib, written in the docs. Instead, I have a file called mod_spatialite.dll, but when I try to locate this file, it throws a OperationalError: Det angivne modul blev ikke fundet (danish for: "The specified module was not found"):
modelDb.init_spatialite('C:\\...\\mod_spatialite-5.1.0-win-x86\\mod_spatialite.dll')
Furthermore, I tried to follow this guide on how to install SpatiaLite on Windows, but that doesn't seem to be working either.
So... what I am doing wrong? Cannot figure it out. Thanks in advance for your help :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Python API documentation for find_spatialite() and init_spatialite(), then reproduce the Windows call using the reported mod_spatialite.dll path. Determine what the Windows loading error means and whether the documentation needs Windows-specific installation or initialization guidance. Done means a Windows user can install the extension and load it without the reported TypeError or OperationalError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlite
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100