I am using Fedora 24 Linux, and I have QGIS 2.14 (Essen) installed. Whenever I go to open up QGIS I get an error for Pyspatialite Plugin. Here is what that error message says:
ImportError: No module named pyspatialite
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 281, in loadPlugin
__import__(packageName)
File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/usr/share/qgis/python/plugins/processing/__init__.py", line 29, in
from processing.tools.general import *
File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/usr/share/qgis/python/plugins/processing/tools/general.py", line 28, in
from processing.core.Processing import Processing
File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/usr/share/qgis/python/plugins/processing/core/Processing.py", line 40, in
from processing.core.GeoAlgorithm import GeoAlgorithm
File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/usr/share/qgis/python/plugins/processing/core/GeoAlgorithm.py", line 41, in
from processing.core.parameters import ParameterRaster, ParameterVector, ParameterMultipleInput, ParameterTable, Parameter
File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/usr/share/qgis/python/plugins/processing/core/parameters.py", line 33, in
from processing.tools.vector import resolveFieldIndex, features
File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/usr/share/qgis/python/plugins/processing/tools/vector.py", line 20, in
from processing.algs.qgis import spatialite_utils
File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/usr/share/qgis/python/plugins/processing/algs/qgis/spatialite_utils.py", line 28, in
from pyspatialite import dbapi2 as sqlite
File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named pyspatialite
After that when I go to the command line to install pyspatialite this is what I get from the Terminal:
sudo 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-YCt2RP/pyspatialite/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-l8Jqvd-record/install-record.txt --single-version-externally-managed --compile:
/usr/lib/python2.7/site-packages/setuptools/dist.py:285: 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-x86_64-2.7
creating build/lib.linux-x86_64-2.7/pyspatialite
copying lib/pyspatialite/dump.py -> build/lib.linux-x86_64-2.7/pyspatialite
copying lib/pyspatialite/dbapi2.py -> build/lib.linux-x86_64-2.7/pyspatialite
copying lib/pyspatialite/__init__.py -> build/lib.linux-x86_64-2.7/pyspatialite
running build_ext
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-YCt2RP/pyspatialite/setup.py", line 309, in
main()
File "/tmp/pip-build-YCt2RP/pyspatialite/setup.py", line 306, in main
setup(**get_setup_args())
File "/usr/lib64/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib64/python2.7/distutils/command/install.py", line 563, in run
self.run_command('build')
File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib64/python2.7/distutils/command/build.py", line 127, in run
self.run_command(cmd_name)
File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/site-packages/setuptools/command/build_ext.py", line 49, in run
_build_ext.run(self)
File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 448, in build_extensions
self.build_extension(ext)
File "/tmp/pip-build-YCt2RP/pyspatialite/setup.py", line 175, in build_extension
self.check_header(ext,"proj_api.h")
File "/tmp/pip-build-YCt2RP/pyspatialite/setup.py", line 154, in check_header
raise HeaderNotFoundException("cannot find %s, bailing out" % header)
__main__.HeaderNotFoundException: cannot find proj_api.h, bailing out
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build- YCt2RP/pyspatialite/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-l8Jqvd-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-YCt2RP/pyspatialite/
I have tried to install all dependencies but I don't know if this is a dependency issue or not.
Answer
Unfortunately fedora does not ship a pyspatialite package in the repositories. You can install it using pip but since pyspatialite is more than just some python files and contains compiled parts you will also need some dependencies installed before.
sudo dnf install gcc python-devel sqlite-devel geos-devel proj-devel python-pip redhat-rpm-config
CFLAGS=-I/usr/include pip --user install pyspatialite
Source http://blog.oddbit.com/2015/11/17/installing-pyspatialite-on-fedora/
No comments:
Post a Comment