Skip to content

Instantly share code, notes, and snippets.



Last active Nov 9, 2020
What would you like to do?
Installing Spatialite for Django on Ubuntu/Debian
#On Debian 7.0
#Install build essentials
sudo apt-get install build-essential
#Install dependencies
sudo apt-get install binutils libproj-dev gdal-bin
sudo apt-get install libgeos-dev
sudo apt-get install libexpat1 libexpat1-dev
sudo apt-get install pkg-config
sudo apt-get install python2.7-dev # for pysqlite-2.6.3's C source
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
#Installing SQlite from source
tar xzf sqlite-amalgamation-
cd sqlite-
sudo make install
#For raspberry
sudo apt-get install libgeos++
#Install libspatialite from source
tar xzf libspatialite-amalgamation-2.4.0-5.tar.gz
cd libspatialite-amalgamation-2.4.0/
./configure --with-proj-include=/usr/include --with-proj-lib=/usr/lib --with-geos-include=/usr/include --with-geos-lib=/usr/lib
sudo make install
#Install spatialite-tools-2.4.0
pkg-config --libs spatialite #check
#for 'floor@@GLIBC_2.2.5' is defined in DSO error
export LDFLAGS="$LDFLAGS -lm"
tar xzf spatialite-tools-2.4.0-5.tar.gz
cd spatialite-tools-2.4.0/
sudo make install
tar xzf pysqlite-2.6.3.tar.gz
cd pysqlite-2.6.3
vim setup.cfg #comment
#must look like something like this:
# [build_ext]
# #define=
# include_dirs=/usr/local/include
# library_dirs=/usr/local/lib
# libraries=sqlite3
sudo python install
# now run your Django project by
python runserver

This comment has been minimized.

Copy link

@vicentimartins vicentimartins commented Jun 12, 2018

I try follow this steps, but now I'm getting this error:

OSError: /usr/lib/x86_64-linux-gnu/ undefined symbol: sqlite3_create_function_v2

Can you help me with this? I need to install spatialite like dependency in my django project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.