danioxoli / HotSpotAnalysis_Plugin

A QGIS plugin for hotspot analysis
GNU General Public License v3.0
56 stars 13 forks source link

failed to launch hotspot analysis #67

Open kainan97 opened 3 years ago

kainan97 commented 3 years ago

Hi, I have downloaded the pysal 1.14.3 and reopened the qgis. But when I launch hotspot analysis, there is still an error. like:

Couldn't load plugin 'HotspotAnalysis' due to an error when calling its classFactory() method

ImportError: dlopen(/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so, 2): Library not loaded: /opt/X11/lib/libxcb.1.dylib Referenced from: /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so Reason: image not found Traceback (most recent call last): File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 334, in _startPlugin plugins[packageName] = package.classFactory(iface) File "/Users/nancy/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/HotspotAnalysis/init.py", line 34, in classFactory from .hotspot_analysis import HotspotAnalysis File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Users/nancy/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/HotspotAnalysis/hotspot_analysis.py", line 38, in import pysal File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pysal/init.py", line 3, in from . import explore File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pysal/explore/init.py", line 4, in import pointpats File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pointpats/init.py", line 4, in from .pointpattern import PointPattern File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pointpats/pointpattern.py", line 12, in from matplotlib import pyplot as plt File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/pyplot.py", line 36, in import matplotlib.colorbar File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/colorbar.py", line 44, in import matplotlib.contour as contour File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/contour.py", line 17, in import matplotlib.text as text File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/text.py", line 16, in from .textpath import TextPath # Unused, but imported by others. File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/textpath.py", line 11, in from matplotlib.mathtext import MathTextParser File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/mathtext.py", line 27, in from PIL import Image File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/Image.py", line 94, in from . import _imaging as core File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ImportError: dlopen(/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so, 2): Library not loaded: /opt/X11/lib/libxcb.1.dylib Referenced from: /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so Reason: image not found

Python version: 3.8.7 (default, Feb 10 2021, 09:04:08) [Clang 12.0.0 (clang-1200.0.32.29)] QGIS version: 3.16.6-Hannover Hannover, 5fc23455ff

Python Path: /Users/nancy/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis2fds /Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python /Users/nancy/Library/Application Support/QGIS/QGIS3/profiles/default/python /Users/nancy/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins /Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/plugins /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/cftime-1.2.1-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/opencv_contrib_python-4.3.0.36-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Fiona-1.8.13.post1-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python38.zip /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8 /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/geopandas-0.8.1-py3.8.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pyproj-2.6.0-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/rasterio-1.1.5-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/click_plugins-1.1.1-py3.8.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numpy-1.20.1-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/snuggs-1.4.7-py3.8.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/scipy-1.5.1-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/GDAL-3.2.1-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/lib-dynload /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numba-0.50.1-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/statsmodels-0.11.1-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pandas-1.1.0-py3.8-macosx-10.13.0-x86_64.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/affine-2.3.0-py3.8.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Rtree-0.9.4-py3.8.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/patsy-0.5.1-py3.8.egg /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/netCDF4-1.5.4-py3.8-macosx-10.13.0-x86_64.egg /Users/nancy/Library/Application Support/QGIS/QGIS3/profiles/default/python /Users/nancy/Desktop

danioxoli commented 3 years ago

Hi,

the dependency installation on macOS seems not effective on the latest QGIS LTR.

However, the plugin version using PySAL 1.14 is no more supported by Python 3.8 (used by QGIS 3.16). I suggest you to move on the latest plugin version that you can find here: https://github.com/danioxoli/HotSpotAnalysis_Plugin/tree/qgis3pysal2 (this use pysal==2.0.0).

I am trying to figure out how to install the dependencies on MacOS but it seems more complex than before. You can find some insight here: https://www.lutraconsulting.co.uk/blog/2020/10/01/qgis-macos-package/

Hope to share with you a solution soon

Daniele

danioxoli commented 3 years ago

Hello,

if the issue is not fixed, you may try a manual workaround that was suggested here: https://github.com/danioxoli/HotSpotAnalysis_Plugin/issues/61#issuecomment-789404562 (use it along with the pysal 2 versions of the plugin: https://github.com/danioxoli/HotSpotAnalysis_Plugin/tree/qgis3pysal2)

So far this has worked for some users.

Best