danioxoli / HotSpotAnalysis_Plugin

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

Plugin not installing.. OSError: could not find or load spatialindex_c.dll #39

Closed ecodiv closed 4 years ago

ecodiv commented 4 years ago

Hi, I am trying to install the plugin (Windows 10, QGIS via OSGeo4W, pysal version 2.1.0), version qgis3pysal2 version. I am getting the following error. Do you have an idea how I can solve this?

Rgds, Paulo

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

OSError: could not find or load spatialindex_c.dll 
Traceback (most recent call last):
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:/Users/brp/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotSpotAnalysis_Plugin-qgis3pysal2\__init__.py", line 34, in classFactory
    from .hotspot_analysis import HotspotAnalysis
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Users/brp/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotSpotAnalysis_Plugin-qgis3pysal2\hotspot_analysis.py", line 38, in 
    import pysal
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\pysal\__init__.py", line 2, in 
    from . import lib
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\pysal\lib\__init__.py", line 28, in 
    from . import io
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\pysal\lib\io\__init__.py", line 3, in 
    from .iohandlers import *
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\pysal\lib\io\iohandlers\__init__.py", line 4, in 
    from . import gwt
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\pysal\lib\io\iohandlers\gwt.py", line 3, in 
    from ...weights.weights import W
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\pysal\lib\weights\__init__.py", line 2, in 
    from .distance import *
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\pysal\lib\weights\distance.py", line 7, in 
    from .util import isKDTree, get_ids, get_points_array_from_shapefile,\
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\pysal\lib\weights\util.py", line 17, in 
    import geopandas as gpd
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\geopandas\__init__.py", line 1, in 
    from geopandas.geoseries import GeoSeries
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\geopandas\geoseries.py", line 12, in 
    from geopandas.base import GeoPandasBase, _series_unary_op, _CoordinateIndexer
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\geopandas\base.py", line 14, in 
    from rtree.core import RTreeError
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\rtree\__init__.py", line 1, in 
    from .index import Rtree
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\rtree\index.py", line 5, in 
    from . import core
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 737, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\rtree\core.py", line 116, in 
    raise OSError("could not find or load spatialindex_c.dll")
OSError: could not find or load spatialindex_c.dll
ecodiv commented 4 years ago

I managed to install the plugin without further error messages following this suggestion:

changing the core.py file in Rtree in C:\OSGeo4W64\apps\Python37\lib\site-packages\rtree>

and changed this line :

rt = _load_library('spatialindex_c.dll', ctypes.cdll.LoadLibrary) by this :

rt = _load_library('spatialindex_c-64.dll', ctypes.cdll.LoadLibrary)

However, the plugin does not function, clicking the icon does not do anything (no error messages either).

danioxoli commented 4 years ago

Dear Paolo,

thanks for your interest.

I’ve only started the update to pysal 2 and therefore the version of the plugin you are trying to use is far to be stable. To date, only some transaltion of the APIs has been included in the source code.

Please, switch back on pysal 1.14 using this branch that is the version currently available on the QGIS plugin repo.

Hope to find time to officially move to pysal 2 soon

Best

Daniele

ecodiv commented 4 years ago

Dear Daniele, thanks for the feedback