I am using Mac OSX Sierra (10.12.1), and I reinstalled QGIS 2.14.7 (and python 2.7, after a crash and clean install of OSX). Now when I open QGIS I get an error for Pyspatialite Plugin. I found the same question for Fedora (Pyspatialite Installation Error), but the solution doesn't seem to work for my system.
My QGIS error message says:
2016-11-07T11:47:02 1 Traceback (most recent call last):
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 281, in loadPlugin
__import__(packageName)
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/__init__.py", line 29, in
from processing.tools.general import *
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/tools/general.py", line 28, in
from processing.core.Processing import Processing
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/core/Processing.py", line 40, in
from processing.core.GeoAlgorithm import GeoAlgorithm
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/core/GeoAlgorithm.py", line 41, in
from processing.core.parameters import ParameterRaster, ParameterVector, ParameterMultipleInput, ParameterTable, Parameter
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/core/parameters.py", line 33, in
from processing.tools.vector import resolveFieldIndex, features
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/tools/vector.py", line 20, in
from processing.algs.qgis import spatialite_utils
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/qgis/spatialite_utils.py", line 28, in
from pyspatialite import dbapi2 as sqlite
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 572, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named pyspatialite
I've searched everything I can for how to install pyspatialite with pip, but in the terminal I keep getting a bailout error when I try "pip install pyspatialite", and I'm new to the terminal and to python so I can't figure out the message.
Error message:
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/34/fnw01lcx0r53cyz_hmfgk1d00000gn/T/pip-build-jqRZzp/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 /var/folders/34/fnw01lcx0r53cyz_hmfgk1d00000gn/T/pip-ep2nth-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/34/fnw01lcx0r53cyz_hmfgk1d00000gn/T/pip-build-jqRZzp/pyspatialite/
When I installed QGIS (from kyngchaos), I installed the list of python modules (Numpy etc) and I've now brew installed sqlite3, but I'm still getting the bailout error.
Did I incorrectly install something or am I missing a dependency, specifically for OSX?
Answer
There is a path problem in the Kyng Chaos SQLite installer (in GDAL 2.0, I don't know with the new 2.1)
The content of the sqlite-py2.7.pth is
import sys; sys.path.insert(0,'/Library/Frameworks/SQLite3.framework/Versions/C/Python/2.7')
It is a Python .pth file ( site), installed in /Library/Python/2.7/site-packages/sqlite-py2.7.pth and pointing to /Library/Frameworks/SQLite3.framework/Versions/C/Python/2.7
The problem is that this folder does not exist, the installer installs /Library/Frameworks/SQLite3.framework/Versions/C/Python/2.5 (see figure)
Therefore, you can
1) modify the name of the folder /Library/Frameworks/SQLite3.framework/Versions/C/Python/2.5 to /Library/Frameworks/SQLite3.framework/Versions/C/Python/2.7
2) or modify the sqlite-py2.7.pth file to
import sys; sys.path.insert(0,'/Library/Frameworks/SQLite3.framework/Versions/C/Python/2.5')
The QGIS version of Kyng Chaos uses exclusively the Apple Python installed and not Homebrew or other Python installers (/usr/local/opt/python/bin/python2.7 for example) with modules installed in /Library/Python/2.7/site-packages/ and the frameworks installed in /Library/Frameworks/. It don't recognize and use the Homebrew version of sqlite3 (look at QGIS Python version)
No comments:
Post a Comment