How to use/install rtree in sqlite3 module in python 2.7 on windows

2.3k views Asked by At

I'm trying to use spatialite database with my django project that is using contrib.gis application (GeoDjango). When syncing database django gives an error "no such module: rtree". Apparently the sqlite3 module that ships with python 2.7.3 doesn't support rtree in sqlite database.

How this can be fixed?

2

There are 2 answers

0
Xavier Combelle On

looks like you need to install a spatial backend such as spatiallite see https://pypi.python.org/pypi/pyspatialite

0
BradHards On

You need to build sqlite with the

SQLITE_ENABLE_RTREE

flag set. How you do that depends on your environment, but typically adding something like:

-DSQLITE_ENABLE_RTREE=1

to your compiler flags will usually be enough.