[Qgis-user] Pyspatialite installation issues on Fedora 25

Eric Goddard egoddard1010 at gmail.com
Mon Dec 19 10:37:51 PST 2016


Hi William, I had the same problem on Fedora 25 and solved it with
comment 5 at https://bugzilla.redhat.com/show_bug.cgi?id=1340535.
Create a pyspatialite.py file in ~/.qgis2/python with the following
contents:

from sqlite3 import *

def connect(*args, **kwargs):
    import sqlite3
    db = sqlite3.connect(*args, **kwargs)
    db.enable_load_extension(True)
    db.load_extension("mod_spatialite")
    return db


and processing should work.

Hope that helps!

Eric

On Mon, Dec 19, 2016 at 10:46 AM, William G. Guthe <wguthe at princeton.edu> wrote:
> Hi,
>
>
>
> I’ve installed QGIS 2.14.3-Essen on an i386 Toughbook running Fedora 25.
> The Processing plugin is missing the pyspatialite module, so I followed
> directions at
> http://blog.oddbit.com/2015/11/17/installing-pyspatialite-on-fedora/ to
> install the dependencies and pyspatialite itself.
>
>
>
> All’s good until I get to the CFLAGS=-I/usr/include pip install pyspatialite
> line of the instructions.  I get this back:
>
>
>
> # CFLAGS=-I/usr/include pip install pyspatialite
> Collecting pyspatialite
>   Using cached pyspatialite-3.0.1-alpha-0.tar.gz
> Installing collected packages: pyspatialite
>   Running setup.py install for pyspatialite ... error
>     Complete output from command /usr/bin/python -u -c "import setuptools,
> tokenize;__file__='/tmp/pip-build-ZUHKMv/pyspatialite/setup.py';f=getattr(tokenize,
> 'open', open)(__file__);code=f.read().replace('\r\n',
> '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record
> /tmp/pip-3kvpOW-record/install-record.txt
> --single-version-externally-managed --compile:
>     /usr/lib/python2.7/site-packages/setuptools/dist.py:364: UserWarning:
> Normalizing '3.0.1-alpha-0' to '3.0.1a0'
>       normalized_version,
>     running install
>     running build
>     running build_py
>     creating build
>     creating build/lib.linux-i686-2.7
>     creating build/lib.linux-i686-2.7/pyspatialite
>     copying lib/pyspatialite/dump.py ->
> build/lib.linux-i686-2.7/pyspatialite
>     copying lib/pyspatialite/dbapi2.py ->
> build/lib.linux-i686-2.7/pyspatialite
>     copying lib/pyspatialite/__init__.py ->
> build/lib.linux-i686-2.7/pyspatialite
>     running build_ext
>     creating tmp
>     gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
> -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom
> -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g
> -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom
> -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC
> -I/usr/include/python2.7 -I/usr/include -c /tmp/pj_init_plus1zSZm0.c -o
> tmp/pj_init_plus1zSZm0.o
>     /tmp/pj_init_plus1zSZm0.c:1:1: warning: return type defaults to ‘int’
> [-Wimplicit-int]
>      main (int argc, char **argv) {
>      ^~~~
>     /tmp/pj_init_plus1zSZm0.c: In function ‘main’:
>     /tmp/pj_init_plus1zSZm0.c:2:5: warning: implicit declaration of function
> ‘pj_init_plus’ [-Wimplicit-function-declaration]
>          pj_init_plus();
>          ^~~~~~~~~~~~
>     gcc -pthread tmp/pj_init_plus1zSZm0.o -L/usr/lib -L/usr/lib -lm -lproj
> -o a.out
>     gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
> -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom
> -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g
> -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom
> -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC
> -I/usr/include/python2.7 -I/usr/include -c
> /tmp/GEOSTopologyPreserveSimplifyJ2Z9Vr.c -o
> tmp/GEOSTopologyPreserveSimplifyJ2Z9Vr.o
>     /tmp/GEOSTopologyPreserveSimplifyJ2Z9Vr.c:1:1: warning: return type
> defaults to ‘int’ [-Wimplicit-int]
>      main (int argc, char **argv) {
>      ^~~~
>     /tmp/GEOSTopologyPreserveSimplifyJ2Z9Vr.c: In function ‘main’:
>     /tmp/GEOSTopologyPreserveSimplifyJ2Z9Vr.c:2:5: warning: implicit
> declaration of function ‘GEOSTopologyPreserveSimplify’
> [-Wimplicit-function-declaration]
>          GEOSTopologyPreserveSimplify();
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     gcc -pthread tmp/GEOSTopologyPreserveSimplifyJ2Z9Vr.o -L/usr/lib
> -L/usr/lib -lm -lgeos -lgeos_c -o a.out
>     gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
> -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom
> -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g
> -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom
> -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC
> -I/usr/include/python2.7 -I/usr/include -c /tmp/iconvzp2nyR.c -o
> tmp/iconvzp2nyR.o
>     /tmp/iconvzp2nyR.c:1:1: warning: return type defaults to ‘int’
> [-Wimplicit-int]
>      main (int argc, char **argv) {
>      ^~~~
>     /tmp/iconvzp2nyR.c: In function ‘main’:
>     /tmp/iconvzp2nyR.c:2:5: warning: implicit declaration of function
> ‘iconv’ [-Wimplicit-function-declaration]
>          iconv();
>          ^~~~~
>     building 'pyspatialite._spatialite' extension
>     creating build/temp.linux-i686-2.7
>     creating build/temp.linux-i686-2.7/src
>     creating build/temp.linux-i686-2.7/amalgamation
>     creating
> build/temp.linux-i686-2.7/amalgamation/libspatialite-amalgamation-3.0.1
>     gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
> -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom
> -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g
> -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom
> -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC
> -DVERSION="3.0.1" -DSQLITE_ENABLE_RTREE=1 -DNDEBUG=1 -DSPL_AMALGAMATION=1
> -DMODULE_NAME="spatialite.dbapi2" -DHAVE_PROJ_API_H=1 -DHAVE_GEOS_C_H=1
> -Iamalgamation/libspatialite-amalgamation-3.0.1/headers
> -I/usr/include/python2.7 -I/usr/include -c src/module.c -o
> build/temp.linux-i686-2.7/src/module.o -DOMIT_FREEXL
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:648:8: error: redefinition of ‘struct
> sqlite3_file’
>      struct sqlite3_file {
>             ^~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:818:16:
> note: originally defined here
>      typedef struct sqlite3_file sqlite3_file;
>                     ^~~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:743:8: error: redefinition of ‘struct
> sqlite3_io_methods’
>      struct sqlite3_io_methods {
>             ^~~~~~~~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:820:16:
> note: originally defined here
>        const struct sqlite3_io_methods *pMethods;  /* Methods for an open
> file */
>                     ^~~~~~~~~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:1217:8: error: redefinition of ‘struct
> sqlite3_vfs’
>      struct sqlite3_vfs {
>             ^~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:1198:16:
> note: originally defined here
>      typedef struct sqlite3_vfs sqlite3_vfs;
>                     ^~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:1514:8: error: redefinition of ‘struct
> sqlite3_mem_methods’
>      struct sqlite3_mem_methods {
>             ^~~~~~~~~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:1493:16:
> note: originally defined here
>      typedef struct sqlite3_mem_methods sqlite3_mem_methods;
>                     ^~~~~~~~~~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:5776:8: error: redefinition of ‘struct
> sqlite3_module’
>      struct sqlite3_module {
>             ^~~~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:5012:16:
> note: originally defined here
>      typedef struct sqlite3_module sqlite3_module;
>                     ^~~~~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:5905:8: error: redefinition of ‘struct
> sqlite3_index_info’
>      struct sqlite3_index_info {
>             ^~~~~~~~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:5010:16:
> note: originally defined here
>      typedef struct sqlite3_index_info sqlite3_index_info;
>                     ^~~~~~~~~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:5908:10: error: redefinition of ‘struct
> sqlite3_index_constraint’
>        struct sqlite3_index_constraint {
>               ^~~~~~~~~~~~~~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:5121:10:
> note: originally defined here
>        struct sqlite3_index_constraint {
>               ^~~~~~~~~~~~~~~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:5915:10: error: redefinition of ‘struct
> sqlite3_index_orderby’
>        struct sqlite3_index_orderby {
>               ^~~~~~~~~~~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:5128:10:
> note: originally defined here
>        struct sqlite3_index_orderby {
>               ^~~~~~~~~~~~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:5920:10: error: redefinition of ‘struct
> sqlite3_index_constraint_usage’
>        struct sqlite3_index_constraint_usage {
>               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:5133:10:
> note: originally defined here
>        struct sqlite3_index_constraint_usage {
>               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:6018:8: error: redefinition of ‘struct
> sqlite3_vtab’
>      struct sqlite3_vtab {
>             ^~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:5009:16:
> note: originally defined here
>      typedef struct sqlite3_vtab sqlite3_vtab;
>                     ^~~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:6042:8: error: redefinition of ‘struct
> sqlite3_vtab_cursor’
>      struct sqlite3_vtab_cursor {
>             ^~~~~~~~~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:5011:16:
> note: originally defined here
>      typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;
>                     ^~~~~~~~~~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:6537:8: error: redefinition of ‘struct
> sqlite3_mutex_methods’
>      struct sqlite3_mutex_methods {
>             ^~~~~~~~~~~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:5710:16:
> note: originally defined here
>      typedef struct sqlite3_mutex_methods sqlite3_mutex_methods;
>                     ^~~~~~~~~~~~~~~~~~~~~
>     In file included from src/statement.h:29:0,
>                      from src/module.c:25:
>     /usr/include/sqlite3.h:7262:8: error: redefinition of ‘struct
> sqlite3_pcache_methods’
>      struct sqlite3_pcache_methods {
>             ^~~~~~~~~~~~~~~~~~~~~~
>     In file included from src/connection.h:33:0,
>                      from src/module.c:24:
>
> amalgamation/libspatialite-amalgamation-3.0.1/headers/spatialite/sqlite3.h:6325:16:
> note: originally defined here
>      typedef struct sqlite3_pcache_methods sqlite3_pcache_methods;
>                     ^~~~~~~~~~~~~~~~~~~~~~
>     error: command 'gcc' failed with exit status 1
>
>     ----------------------------------------
> Command "/usr/bin/python -u -c "import setuptools,
> tokenize;__file__='/tmp/pip-build-ZUHKMv/pyspatialite/setup.py';f=getattr(tokenize,
> 'open', open)(__file__);code=f.read().replace('\r\n',
> '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record
> /tmp/pip-3kvpOW-record/install-record.txt
> --single-version-externally-managed --compile" failed with error code 1 in
> /tmp/pip-build-ZUHKMv/pyspatialite/
>
>
>
> Sqlite3 imports into python, and the other dependencies seem to be fine.
> Any advice on this much appreciated.
>
>
>
>
>
> Thanks,
>
> Bill Guthe
>
> Research Computing/ OIT
>
> Princeton University
>
> Princeton, NJ  USA
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user



More information about the Qgis-user mailing list