Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--load-extension=spatialite not working with datasetteproject/datasette docker image #1114

Closed
danp opened this issue Nov 29, 2020 · 4 comments

Comments

@danp
Copy link
Sponsor Contributor

danp commented Nov 29, 2020

6aa5886 added the --load-extension=spatialite shortcut looking for the extension in these places:

# Can replace with sqlite-utils when I add that dependency
SPATIALITE_PATHS = (
"/usr/lib/x86_64-linux-gnu/mod_spatialite.so",
"/usr/local/lib/mod_spatialite.dylib",
)

However, in the datasetteproject/datasette docker image the file is at /usr/local/lib/mod_spatialite.so.

This results in the example command here failing:

% docker run --rm -p 8001:8001 -v `pwd`:/mnt datasetteproject/datasette datasette -p 8001 -h 0.0.0.0 /mnt/data.db --load-extension=spatialite
Error: Could not find SpatiaLite extension

But it does work when given an explicit path:

% docker run --rm -p 8001:8001 -v `pwd`:/mnt datasetteproject/datasette datasette -p 8001 -h 0.0.0.0 /mnt/data.db --load-extension=/usr/local/lib/mod_spatialite.so
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
...

Perhaps SPATIALITE_PATHS should include /usr/local/lib/mod_spatialite.so?

@simonw
Copy link
Owner

simonw commented Nov 29, 2020

This is a great catch, thanks.

@danp
Copy link
Sponsor Contributor Author

danp commented Nov 29, 2020

Thank you!

simonw added a commit that referenced this issue Nov 29, 2020
@simonw
Copy link
Owner

simonw commented Nov 29, 2020

Fix is out in 0.52.1: https://docs.datasette.io/en/latest/changelog.html#v0-52-1

@simonw
Copy link
Owner

simonw commented Nov 29, 2020

The new Docker container is pushed to Docker Hub too. Here's it in action:

% docker pull datasetteproject/datasette
% docker run --rm -p 8001:8001 -v `pwd`:/mnt datasetteproject/datasette datasette --version
datasette, version 0.52.1
% docker run --rm -p 8001:8001 -v `pwd`:/mnt datasetteproject/datasette datasette -p 8001 -h 0.0.0.0 /mnt/nps-spatialite.db --load-extension=spatialite
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)

danp added a commit to danp/datasette that referenced this issue Mar 6, 2022
Helps homebrew on Apple Silicon setups find spatialite without needing
a full path.

Similar to simonw#1114
simonw pushed a commit that referenced this issue Mar 6, 2022
Helps homebrew on Apple Silicon setups find spatialite without needing
a full path.

Similar to #1114

Thanks, @danp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants