danioxoli / HotSpotAnalysis_Plugin

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

Error python on open plug #52

Open bellanz80 opened 3 years ago

bellanz80 commented 3 years ago

hi, i install without problem the plug. But, on open that, python error appears "CHAIN - CHAIN" thank you!

Windows 10 64 bit, QGIS 3.14 stand alone, clean profile

An error has occurred while executing Python code:

TypeError: '>=' not supported between instances of 'Chain' and 'Chain' Traceback (most recent call last): File "C:/Users/UV/AppData/Roaming/QGIS/QGIS3\profiles\pulito/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 551, in run self.load_comboBox() File "C:/Users/UV/AppData/Roaming/QGIS/QGIS3\profiles\pulito/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 472, in load_comboBox thresh = pysal.min_threshold_dist_from_shapefile(path) File "C:\Users\UV\AppData\Roaming\Python\Python37\site-packages\pysal\weights\user.py", line 1085, in min_threshold_dist_from_shapefile return min_threshold_distance(points, p) File "C:\Users\UV\AppData\Roaming\Python\Python37\site-packages\pysal\weights\util.py", line 1136, in min_threshold_distance kd = KDTree(data) File "C:\Users\UV\AppData\Roaming\Python\Python37\site-packages\pysal\cg\kdtree.py", line 52, in KDTree return scipy.spatial.KDTree(data, leafsize) File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\scipy\spatial\kdtree.py", line 248, in init self.maxes = np.amax(self.data,axis=0) File "", line 6, in amax File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\numpy\core\fromnumeric.py", line 2668, in amax keepdims=keepdims, initial=initial, where=where) File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\numpy\core\fromnumeric.py", line 90, in _wrapreduction return ufunc.reduce(obj, axis, dtype, out, **passkwargs) TypeError: '>=' not supported between instances of 'Chain' and 'Chain'

danioxoli commented 3 years ago

Hello,

I have never encountered this specific issue. However, it looks like a problem in the input data. From the error message, I can understand you are using points. Please, be sure that your points are in shapefile format with a projected coordinate system associated and with at least a numeric field (without null values) in the attribute table.

Another known bug is that your analysis shapefile should be placed on the top of the layer panel because the plugin reads the list of the available layers in this order and e.g. if the first is a text-based file or a raster this may generate errors.

Thank you for reporting

Daniele

bellanz80 commented 3 years ago

Thank you for support. I will carry out new tests

bellanz80 commented 3 years ago

hi. I have a new python error. Windows 10 64 bit QGIS 3.14 OSGEO New y clean profile I have install panda winth osgeo for python3 thnak you!

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

AttributeError: module 'pysal' has no attribute 'common' 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/Luca/AppData/Roaming/QGIS/QGIS3\profiles\2/python/plugins\HotspotAnalysis__init.py", line 34, in classFactory from .hotspot_analysis import HotspotAnalysis File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 743, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/Luca/AppData/Roaming/QGIS/QGIS3\profiles\2/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 38, in import pysal File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 743, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\OSGEO4~1\apps\Python37\lib\site-packages\pysal\init__.py", line 46, in pysal.common.pandas = pandas AttributeError: module 'pysal' has no attribute 'common'

danioxoli commented 3 years ago

Please, have a look at issue #15

bellanz80 commented 3 years ago

Hi, on QGIS 3.16 and 3.14 Standalone and OSGEO: Windows 10 New profile

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

SyntaxError: EOL while scanning string literal Traceback (most recent call last): File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 334, in _startPlugin plugins[packageName] = package.classFactory(iface) File "C:/Users/Luca/AppData/Roaming/QGIS/QGIS3\profiles\3.16/python/plugins\HotSpotAnalysis_Plugin-qgis3pysal2__init.py", line 34, in classFactory File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 792, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/Luca/AppData/Roaming/QGIS/QGIS3\profiles\3.16/python/plugins\HotSpotAnalysis_Plugin-qgis3pysal2\hotspot_analysis.py", line 39, in File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 792, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\OSGEO4~2\apps\Python37\lib\site-packages\pysal__init__.py", line 107, in import pysal.spreg File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 792, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\OSGEO4~2\apps\Python37\lib\site-packages\pysal\spreg\init.py", line 1, in from .ols import * File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 792, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\OSGEO4~2\apps\Python37\lib\site-packages\pysal\spreg\ols.py", line 7, in from . import user_output as USER File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 792, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\OSGEO4~2\apps\Python37\lib\site-packages\pysal\spreg\user_output.py", line 9, in from . import diagnostics File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 792, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\OSGEO4~2\apps\Python37\lib\site-packages\pysal\spreg\diagnostics.py", line 12, in from .utils import spmultiply, sphstack, spmin, spmax File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 792, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\OSGEO4~2\apps\Python37\lib\site-packages\pysal\spreg\utils.py", line 10 author__ = "Luc Anselin luc.anselin@asu.edu, \ ^ SyntaxError: EOL while scanning string literal

faalkao commented 3 years ago

Thank you for your very interesting tutorial. I tried and got the following problem. Could you help me out, please? An error has occurred while executing Python code:

ValueError: not enough values to unpack (expected 2, got 1) Traceback (most recent call last): File "/home/phan/.local/share/QGIS/QGIS3/profiles/default/python/plugins/HotspotAnalysis/hotspot_analysis.py", line 564, in run (path, layer_id) = layerName.split('|') ValueError: not enough values to unpack (expected 2, got 1)

Python version: 3.6.9 (default, Oct 8 2020, 12:12:24) [GCC 8.4.0] QGIS version: 3.16.1-Hannover Hannover, b381a90dca

danioxoli commented 3 years ago

Hello,

actually, it seems there is a problem with your input layer. The plugin currently accepts only projected shapefiles of point or polygon (no virtual layer or attributes, no text files). Can you try with the provided test data to confirm that? The plugin is tested successfully till the LTR QGIS version. Still not had time to run a test on the latest release.

Best,

faalkao commented 3 years ago

Thank you very much for your suggestions.

I tried with test_data. It still got a problem with python. Whenever I turn on the hotspot tool, the error comes. I also tried my data with Arcgis and it worked well.

The error, when I try with test_data in QGIS, is as follows.

2020-12-01T09:48:34 WARNING Traceback (most recent call last): File "/home/phan/.local/share/QGIS/QGIS3/profiles/default/python/plugins/HotspotAnalysis/hotspot_analysis.py", line 551, in run self.load_comboBox() File "/home/phan/.local/share/QGIS/QGIS3/profiles/default/python/plugins/HotspotAnalysis/hotspot_analysis.py", line 444, in load_comboBox (path, layer_id) = selectedLayer.dataProvider().dataSourceUri().split('|') ValueError: not enough values to unpack (expected 2, got 1)

2020-12-01T09:48:44 WARNING Traceback (most recent call last): File "/home/phan/.local/share/QGIS/QGIS3/profiles/default/python/plugins/HotspotAnalysis/hotspot_analysis.py", line 530, in self.dlg.comboBox.activated.connect(lambda: self.load_comboBox()) File "/home/phan/.local/share/QGIS/QGIS3/profiles/default/python/plugins/HotspotAnalysis/hotspot_analysis.py", line 444, in load_comboBox (path, layer_id) = selectedLayer.dataProvider().dataSourceUri().split('|') ValueError: not enough values to unpack (expected 2, got 1)

2020-12-01T09:49:23 WARNING Traceback (most recent call last): File "/home/phan/.local/share/QGIS/QGIS3/profiles/default/python/plugins/HotspotAnalysis/hotspot_analysis.py", line 530, in self.dlg.comboBox.activated.connect(lambda: self.load_comboBox()) File "/home/phan/.local/share/QGIS/QGIS3/profiles/default/python/plugins/HotspotAnalysis/hotspot_analysis.py", line 444, in load_comboBox (path, layer_id) = selectedLayer.dataProvider().dataSourceUri().split('|') ValueError: not enough values to unpack (expected 2, got 1)