danioxoli / HotSpotAnalysis_Plugin

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

HotSpotAnalysis_Plugin Installation Problems with each steps in 1.0.3 #27

Closed JMKJim closed 4 years ago

JMKJim commented 5 years ago

Hotspot Installation Problems with steps 1 to 4 in 1.0.3 Hello Daniele, Thanks to you and your colleagues for this plugin, and thanks, too, for your time and effort to sort out my installation problem Windows 10 Home 10.0.17763 Build 17763 QGIS 3.4.5 I followed the steps as set out and numbered in README in HotspotAnalysis 1.0.3 Here are the steps and results: HA QGIS 1.docx HA QGIS 3.docx OSGeo4W 1 OSGeo4W 2

1) Install dependencies py3_env python -m pip install --upgrade pip python -m pip install pysal OSGeo4W Shell resulting bottom line was Successfully installed pysal-2.0.0 Attached File = OSGeo4W 1.png 2) Open QGIS Under Plugins I saw “Python Console” When I tried to install HotspotAnalysis on QGIS the response was: Couldn't load plugin 'HotspotAnalysis' due to an error when calling its classFactory() method ModuleNotFoundError: No module named 'pysal.esda' (Text of QGIS error message is HA QGIS 1.docx) I uninstalled HotspotAnalysis Plugin

3) latest unreleased version I downloaded the zip, opened QGIS and carried out install from zip I got the same result as above for 2) Couldn't load plugin 'HotspotAnalysis' due to an error when calling its classFactory() module ModuleNotFoundError: No module named 'pysal.esda'

The installation window showed version 1.0.2 was installed **4) Pysal Common Error on Windows I went to the github.com…15 I ran OSGeo W Shell

py3_env pip uninstall pysal pip install --no-cache-dir pysal

Bottom line was:

Successfully installed pysal-2.0.0

(File attached as OSGeo4W 2.png)

I uninstalled the HA plugin that was loaded in **3

I restarted QGIS and ran the HA installation

Top message was

Couldn’t load plugin Hotspot Analysis due to an error when calling its classFactory() method

Bottom line was:

ModuleNotFoundError: No module named pysal esda

Window shows 1.0.3 as installed version

Error message is HA QGIS 3.docx

At this point Folders present in Python37 were

Pysal-2.0.0-py37.egg-info Pysal/explore/esda

Many thanks and regards,

Jim

kadirsahbaz commented 5 years ago

I encountered errors like those, too. I solved some and I explained the temporary solution. But rarely I get errors (related other packages, I guess).

danioxoli commented 5 years ago

Dear Jim,

The error you are facing is due to the changes of PySAL API between version <=1.14 and version 2.0 released a few months ago (see also https://github.com/danioxoli/HotSpotAnalysis_Plugin/issues/26#issuecomment-477635923).

The workaround I have suggested in the README so far implies a downgrade of the PySAL lib. However, the temporary solution you figured out is exactly the fix the plugin needs.

The point is that in this transition period from PySAL versions 1.14 and version 2.0, I have prefered to leave the original code on the official QGIS repo because of the former users may still work with the old version of PySAL, therefore they would get an error by upgrading the plugin only.

What I am going to do is to branch the repo to have both plugin version for PySAL 2 and PySAL 1.

I hope to find the time in the next days to do that.

Thank you for your interest and valuable comments

Daniele

JMKJim commented 5 years ago

Hello Daniele,

Thank you very kindly for your reply.

You may have misunderstood a part of my text. I did not find a solution and your plug in did not install. I checked Vector at the end of each step to see if the plug in had installed and it had not, consistent with the error messages.

I am told that Hotspot Analysis is a key part of concluding my research on the impact of marsh erosion on fisheries productivities. I am a volunteer researcher for a non-profit and do not have access to the Arc/GIS Hotspot Analysis, so I hope that can find a solution.

Thanks again for your generous time and effort on behalf of all of us dependent on your plug in

Regards,

Jim


James McDaid Kapetsky, Ph.D.

GIS and Remote Sensing for Fisheries, Aquaculture & Historical Research

7706 Meadowlark Lane, Villa 2

Wilmington NC USA 28411

910-681-0522

From: DOxoli [mailto:notifications@github.com] Sent: Wednesday, April 10, 2019 5:11 AM To: danioxoli/HotSpotAnalysis_Plugin Cc: JMKJim; Author Subject: Re: [danioxoli/HotSpotAnalysis_Plugin] HotSpotAnalysis_Plugin Installation Problems with each steps in 1.0.3 (#27)

Dear Jim,

The error you are facing is due to the changes of PySAL API between version <=1.14 and version 2.0 released a few months ago (see also #26 (comment) https://github.com/danioxoli/HotSpotAnalysis_Plugin/issues/26#issuecomment-477635923 ).

The workaround I have suggested in the README so far implies a downgrade of the PySAL lib. However, the temporary solution you figured out is exactly the fix the plugin needs.

The point is that in this transition period from PySAL versions 1.14 and version 2.0, I have prefered to leave the original code on the official QGIS repo because of the former users may still work with the old version of PySAL, therefore they would get an error by upgrading the plugin only.

What I am going to do is to branch the repo to have both plugin version for PySAL 2 and PySAL 1.

I hope to find the time in the next days to do that.

Thank you for your interest and valuable comments

Daniele

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/danioxoli/HotSpotAnalysis_Plugin/issues/27#issuecomment-481608627 , or mute the thread https://github.com/notifications/unsubscribe-auth/Au2ArlDnsXXiVcWfVLk_dl1nm5c5lb6Rks5vfaqJgaJpZM4cgIAe . https://github.com/notifications/beacon/Au2AruHeZ2Me7B6N3op_0bFXmlH7Zyecks5vfaqJgaJpZM4cgIAe.gif

danioxoli commented 5 years ago

I mean that you got the point on the API change. I started a new branch to update the whole code to the new pysal version.

However, if you need to use the current version of the plugin the best solutions are in order:

1) try to downgrade PySAL

py3_env
python -m pip install --force-reinstall pysal==1.14.3

2) Try a clean QGIS installation using the LTR version (3.4, actually the one you are using) and redo the process with the correct version of PySAL

py3_env
python -m pip install --upgrade pip
python -m pip install pysal==1.14.3

On my Windows machine, the workaround n. 2 solved the problem. I used pysal==1.13.0 actually, but there should not be big differences.

Best,

Daniele

JMKJim commented 5 years ago

Hello Daniele,

Sorry to have to report that the installation failed using your solution #2, the one that worked for you on Win 10.

The brief summary is that OSGeo was able to successfully install pysal1.14.3; however, the QGIS HA installation failed with this message “AttributeError: module 'pysal' has no attribute 'common'

Tried Solution on my laptop and got a Windows error

Then tried Solution #1 on my desktop and got a Windows error there, too.

I am very sorry to have taken so much of your valuable time to solve this problem to no avail

Maybe it is best now for me to wait for the pysal 1 and 2 modifications that you have underway

Thanks and regards,

Jim

Here is a summary of the steps and outcomes

Uninstalled QGIS 3.4.5 and reinstalled not realizing that I had installed 3.4.6

Ran OSGeo 4W your solution #2 that worked on your Win 10

Bottom line was “Successfully installed pysal – 1.14.3”

Opened QGIS, went to plugins and found HA checked 

Uninstalled HA

Ran HA installation and got message below

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:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\pysal__init__.py", line 44, in import pandas File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'pandas'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 335, in startPlugin plugins[packageName] = package.classFactory(iface) File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis__init.py", line 34, in classFactory from .hotspot_analysis import HotspotAnalysis File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 38, in import pysal File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\pysal\init__.py", line 48, in pysal.common.pandas = None AttributeError: module 'pysal' has no attribute 'common'

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.4.6-Madeira Madeira, cc0e375a9f

Python Path:

· C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python

· C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python

· C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins

· C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins

· C:\Program Files\QGIS 3.4\bin\python37.zip

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\DLLs

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib

· C:\Program Files\QGIS 3.4\bin

· C:\PROGRA~1\QGIS3~1.4\apps\Python37

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\win32

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\win32\lib

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\Pythonwin

C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python

HA Window shows HA installed

Checked Vector, HA was not listed

Ran reinstall plugin

Window showed HA successfully installed

Saw that QGIS was 3.4.6 so uninstalled and installed 3.4.5 the latest in that series

Ran solution #2 in OSGWO 4W again with bottom line

Successfully installed pysal – 1.14.3 (see image below)

Opened QGIS showing Python errorat top –calling classFactory()method

In Plug ins HA was checked

There was no opportunity to install or uninstall

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:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\pysal__init__.py", line 44, in import pandas File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'pandas'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 335, in startPlugin plugins[packageName] = package.classFactory(iface) File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis__init.py", line 34, in classFactory from .hotspot_analysis import HotspotAnalysis File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 38, in import pysal File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\pysal\init__.py", line 48, in pysal.common.pandas = None AttributeError: module 'pysal' has no attribute 'common'

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.4.6-Madeira Madeira, cc0e375a9f

Python Path:

· C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python

· C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python

· C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins

· C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins

· C:\Program Files\QGIS 3.4\bin\python37.zip

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\DLLs

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib

· C:\Program Files\QGIS 3.4\bin

· C:\PROGRA~1\QGIS3~1.4\apps\Python37

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\win32

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\win32\lib

· C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\Pythonwin

C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python

Tried Reinstall

No “installation successful message” no HA in Vector

Closed Q and opened with Python error appearing at top

Now trying your solution #1

QGISstill open; go to plug ins – uninstall HA

Closed Qgis

Go to OSGeo 4W

Ran and got Win error message

Could go no further with Solution 1

Tried solution #2 on Laptop (Win 10 100.1734 build 1734 that is different from the desktop)

Uninstalled QGIS 3.4.6 and reinstalled QGIS 3.4.5

Ran OSGeo

Got Win error as below “Cannot find a version that satisfies…”

and pysal – 1.4.3 did not install

From: DOxoli [mailto:notifications@github.com] Sent: Wednesday, April 10, 2019 3:41 PM To: danioxoli/HotSpotAnalysis_Plugin Cc: JMKJim; Author Subject: Re: [danioxoli/HotSpotAnalysis_Plugin] HotSpotAnalysis_Plugin Installation Problems with each steps in 1.0.3 (#27)

I mean that you got the point on the API change. I started a new branch to update the whole code to the new pysal version.

However, if you need to use the current version of the plugin the best solutions are in order:

  1. try to downgrade PySAL

py3_env python -m pip install --force-reinstall pysal==1.14.3

  1. Try a clean QGIS installation using the LTR version (3.4, actually the one you are using) and redo the process with the correct version of PySAL

py3_env python -m pip install --upgrade pip python -m pip install pysal==1.14.3

On my Windows machine, the workaround n. 2 solved the problem. I used pysal==1.13 actually, but there should not be big differences.

Best,

Daniele

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/danioxoli/HotSpotAnalysis_Plugin/issues/27#issuecomment-481833808 , or mute the thread https://github.com/notifications/unsubscribe-auth/Au2Arj8qS-CHt3r0FjyL0pZCF-P3AcLkks5vfj4-gaJpZM4cgIAe . https://github.com/notifications/beacon/Au2ArrQl-VOU2rLxXsTmOt-7eGxgIoctks5vfj4-gaJpZM4cgIAe.gif

danioxoli commented 5 years ago

Dear Jim,

looks quite strange to me because the import is causing errors (pysal.common) is protected by exception in the init.py of pySAL lib.

Check on lines 40-48 of the file at

C:\Program Files\QGIS 3.4\apps\Python37\Lib\site-packages\pysal\__init__.py

You might try to comment (#) these lines to see if the error disappears (see e.g. https://github.com/danioxoli/HotSpotAnalysis_Plugin/issues/15#issuecomment-444915389).

If this does not work, unfortunately, I cannot help you further because the problem may be connected to your specific system settings. Just be sure to run the OSGeo 4W as well as the text editor for changing the init .py as administrator when you are making these changes or lib installation in general.

To avoid the Windows problems (quite frequent with experimental Py plugins) a final suggestion is to use a pre-set virtual machine like the OSGeoLive. With the latter, no pySAL installation is required to run the plugin.

Thanks again for your comments

best,

Daniele