Closed noschinl closed 3 years ago
I also tried the instructions on https://github.com/conda-forge/libspatialite-feedstock/issues/25#issuecomment-387051781, but without success
Reading https://www.gaia-gis.it/fossil/libspatialite/wiki?name=mod_spatialite, I understand that this cannot work, as this package only ships libspatialite.dll on Windows, but not mod_spatialite.dll. Considering that the packages for OS X and Linux contain a mod_spatialite build, as there a reason this package does not ship mod_spatialite on Windows?
The Linux package does not contain mod_spatialite either... I don't think we are building it at all, but finding the documentation very hard to understand. Can you find instructions on how to build mod_spatialite?
@gillins, are you sure about the Linux package not containing mod_spatialite? At least the newest linux file in the conda-forge channel on anaconda contains a mod_spatialite.so?
As for building mod_spatialite: I haven't set up a build environment on Windows yet, but on linux ./configure && make
builds mod_spatialite.
So, I was able to to build libspatialite on windows using mingw. ./configure && make
causes mod_spatialite.dll to be build, too. make install-strip
copies mod_spatialite.dll
to $PREFIX/lib, as expected.
Having tested that, it seems that you are using MSVC instead of mingw, using makefile.vc
instead of configure
-- this may be the source of the problem (as I don't see any instructions for mod_spatialite.dll in there).
I assume that the compiler chain for conda-forge ist fixed?
We have to use MSVC to be compatible with Python. Can you see anyway to build mod_spatialite.dll
with makefile.vc
? Might be a question for upstream.
In theory, this should be possible. The current development versions also contain appropriate makefiles (see the mailing list).
Given that the last release candidate is from 2018, the best way forward would probably to backport these changes. I'll have a look whether this is feasible for me.
Might this help?
NEXTGEN RC1 - loadable modules for Windows
Hi, all, Following the discussion on https://github.com/ContinuumIO/anaconda-issues/issues/10926 (cc @BigBaaadBob), I'd say the best option would be to update the recipe to the 5.0.0 RC1 (@johntruckenbrodt linked the binaries a few days ago) or wait for the full 5.0.0 release soon. I didn't know the official Anaconda package was forked from the conda-forge version (or even it's existence), otherwise I would have posted here from the start.
(EDIT: 5.0.0 has been released: https://groups.google.com/u/2/g/spatialite-users/c/K3gcP9_C1Zo )
As @noschinl mentioned, the latest dev versions of Spatialite do contain the updated scripts for Microsoft Visual Studio, including makefiles for the required mod_spatialite
on Windows instead of the plain libspatialite
.
Compared to Spatialite 4.3.0, Spatialite 5 introduces RTTopo (RT Topology Library) as a dependency (licensed under the GPL) replacing LWGEOM (another GPL library), which is not included the current recipe. Per https://github.com/conda-forge/libspatialite-feedstock/issues/53, RTTopo is not yet available on conda-forge. The build instructions on Windows seem simple enough, hopefully it should be easy to build. Building without RTTopo is possible but would require a larger but still simple patch on Windows (that would keep Spatialite LGPL). For the other systems, --enable-rttopo
is required to enable it (defaults to "no").
I also noticed on https://github.com/conda-forge/freexl-feedstock/pull/18 that for the latest FreeXL the patches need updating.
On the issue per se ("spatialite extension cannot be loaded"), I'd suggest adding a test for loading the SQLite module to ensure it's available, based on the current tests something like:
import os
import sys
import sqlite3
if sys.platform == 'win32':
path = os.path.join(sys.prefix, 'Library', 'bin', 'mod_spatialite.dll')
elif sys.platform == 'darwin':
# LD_LIBRARY_PATH not set on OS X or Linux.
path = os.path.expandvars('$PREFIX/lib/mod_spatialite.dylib')
elif sys.platform.startswith('linux'):
path = os.path.expandvars('$PREFIX/lib/mod_spatialite.so')
else:
raise Exception('Cannot recognize platform {!r}'.format(sys.platform))
# Test loading the resulting SQLite3 extension
db = sqlite3.connect(':memory:')
db.enable_load_extension(True)
db.execute("SELECT load_extension(?)", [path])
db.enable_load_extension(False)
db.close()
I could try to work on this if nobody is available, but I'm not sure about the RTTopo situation (adding it to conda-forge and as a dependency here). Note that I never handled a conda-forge package before either.
It would be great if the conda-forge package of libspatialite would be upgraded to 5.0.0 including rttopo. The current package doesn't seem to include LWGEOM, which cripples it somewhat...
So an upgrade to 5.0.0 with rttopo would solve quite some issues...
@theroggy, @PMeira, @noschinl and others I am working on building 5.0.0 without rttopo here: #56. That will be a start. But someone has to be willing to add rttopo to conda-forge before spatialite can be built with it (see #53).
I've put in the time I can give in #56. If someone has an idea of how to get mod_spatialite
working in Windows (see https://github.com/conda-forge/libspatialite-feedstock/pull/56#discussion_r500929888), We can move forward with 5.0.0. Or if someone has time to put in a ticket: https://www.gaia-gis.it/fossil/libspatialite/reportlist
I've given what I can but I'm going to have to drop this a move on to my own work unless and until I get some suggestions for what else to try.
Okay, libspatialite
5.0.0 is in.
We added tests that check that mod_spatialite
can now be loaded in Windows, so I think this issue is addressed. Please re-open if not.
I am still having this problem in MacOS.
❯ sqlite3
SQLite version 3.46.0 2024-05-23 13:25:27
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .load libspatialite
Error: dlsym(0x8bb10240, sqlite3_spatialite_init): symbol not found
My environment:
micromamba list libspatialite
List of packages in environment: "~/micromamba/envs/PyDev"
Name Version Build Channel
───────────────────────────────────────────────────
libspatialite 5.1.0 hf7a34df_8 conda-forge
@digital-idiot, could you open a new issue and provide the full requested information about your conda environment? This would help us to better help you out. The information you provided above isn't quite enough on its own.
Issue: Loading the spatialite extension either in sqlite3 or in Python's sqlite3 module fails
I installed the libspatialite package and tried to use it either in the sqlite3 command line client or with the python sqlite3 modile:
(Sorry for the german error messages, I don't know how to change them to english).
The error messages for the python case are the same.
Environment (
conda list
):Details about
conda
and system (conda info
):