From http://elgis.argeo.org/repos/6/, find the latest repo rpm, and install it as root:
`sudo rpm -Uvh http://elgis.argeo.org/repos/6/elgis-release-6-6_0.noarch.rpm`
yum install python-devel(needed by Shapely to compile C extensions)yum install bzip2 bzip2-devel(needed by Scrapy : remove this when this is no longer a dependency)yum install gdal gdal-develyum install geos geos-develyum install proj proj-develyum install libxml2 libxml2-devel(needed to make xpath searching efficient)yum install libxslt libxslt-develyum install sqlite sqlite-develyum install expat expat-devel(this is needed by spatialite-tools)
TODO: Add instructions for doing this
- The default version of sqlite3 that is installed is not the current version (3.8.1 as of writing this), but an older version - 3.6.20 in my system. However, the current version of spatialite-tools will not compile with the older version. Hence, we have to compile/install this version. I did this from source (since my repos didn’t have the latest version).
- The default ‘make install’ installs all libraries/binaries on /usr/local/lib. This is usually not where the rpm packages install the libraries (in my system, this is /usr/lib64). When building, we have to make sure that the build system looks at this directory - something we will acheive using the
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfigtrick.
First, let’s get the latest version of sqlite3 compiled and installed (to /usr/local/lib — so this shouldn’t mess with the yum installed version). For this, head over to http://www.sqlite.org/download.html and download the latest sqlite3-autoconf tarball. For me, that was http://www.sqlite.org/2013/sqlite-autoconf-3080100.tar.gz as of this time of writing.
- Download to a directory using
wget http://www.sqlite.org/2013/sqlite-autoconf-3080100.tar.gzor something similar. - Extract and cd to that directory
- Do
./configure - Do
sudo make installif you are not running as root (ignore ‘sudo’ if you are running as root).
- Download the latest version from http://www.gaia-gis.it/gaia-sins/ using ‘wget http://www.gaia-gis.it/gaia-sins/libspatialite-4.1.1.zip’
- Extract and cd to that directory
- Do :
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig - Do :
./configure —enable-freexl=no - Do :
sudo make install
- Download the latest version from https://www.gaia-gis.it/fossil/readosm/index; For me, this was http://www.gaia-gis.it/gaia-sins/readosm-1.0.0b.tar.gz
- Extract and cd to that directory
- Do :
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig - Do :
./configure - Do :
sudo make install
- Download the latest version from https://www.gaia-gis.it/fossil/spatialite-tools/index. For me, this was http://www.gaia-gis.it/gaia-sins/spatialite-tools-4.1.1.tar.gz
- Extract and cd to that directory
- Do :
./configure —enable-freexl=no - Do :
sudo make install
The default sqlite3 module or the external pysqlite modules don't come with the enable_load_extension method enabled (since some platforms have SQLite libraries which are compiled without this feature).
So, we have to compile the pysqlite3 extension with this feature enabled (since its easier to do this than to compile python)
This is the simple part. Do:
`pip install pysqlite --no-install`
Change into the package source directory:
`cd <virtual_env_dir>/build/pysqlite`
Assuming that you have done the previous dependency install steps, you should have the sqlite 3.8.1 version installed in /usr/local/lib. Prepend that to $LD_LIBRARY_PATH:
`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib`
Edit setup.cfg and comment out the line containing this define:
`#define SQLITE_OMIT_LOAD_EXTENSION`
Now, do:
`pip install --no-download -I pysqlite`
This will compile sqlite3, and install the pysqlite package containing the latest version of sqlite3 (3.8.1 as of this writing)
Verify that this is indeed the case by doing this from the python prompt:
from pysqlite2 import dbapi2 as sqlite3
sqlite3.sqlite_version_info
This should show:
`(3, 8, 1)`
Not only this, now you can load the spatialite library by doing this:
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:") #obviously, use your actual database filename here
con.enable_load_extension(True)
con.execute('SELECT load_extension("/usr/local/lib/libspatialite.so")')
I was greatly helped by the above explanation. I've installed QGIS in Fedora 25, but hit with the issue of the absence of pyspatialite package. By order of the steps above I've been able to enjoy QGIS application for the purposes of research on my Fedora. thanks.
Dwicahya Sulistyawan,
from a country full of beautiful natural scenery on the equator
Indonesia