Open dbrosi opened 3 years ago
hello,
It looks like the Pysal version used by QGIS is not 1.14 but superior. You can check directly from the python console of QGIS by typing:
import pysal
print(pysal.__version__)
then:
1) If by chance you have there pysal version 2.0, you can simply uninstall the plugin and install from zip this new version of the plugin which works with pysal 2.0: https://github.com/danioxoli/HotSpotAnalysis_Plugin/archive/qgis3pysal2.zip
2) If the version of pysal is instead actually 1.14, I suggest you to try to uninstall it from the terminal by typing:
python -m pip uninstall pysal
and the proceed with a new installation of pysal 2.0 like:
sudo pip3 install pysal==2.0
.
I believe the problem can be solved with option 1) as pysal 2.0 should be already present in the MacOS QGIS.
let me know if this was useful.
best,
Thanks for the quick response! I went through all the steps that you said, but then came up with this message:
Couldn't load plugin 'HotSpotAnalysis_Plugin-qgis3pysal2' due to an error when calling its classFactory() method ModuleNotFoundError: No module named 'pysal.explore.esda'
However, I took the pysal 2.0 folder (that I knew was located in /Library/Frameworks/Python.framework/Versions/3.9/lib/ python3.9/site-packages through my terminal) and copied it into the folder /Applications/QGIS.app/Contents/ Resources/python and it worked!
So I think it was a combination of needing the new HotSpotAnalysis_Plugin that you provided me and placing it in the correct folder for QGIS to reach it.
Again, thanks for all of your help!
I have had the same issue, but for some reason have not had any luck. I am not experienced with python, but I have used R quite a bit. After uninstalling the plugin and reinstalling it using the link you provided, I get the error "Couldn't load plugin 'HotSpotAnalysis_Plugin-qgis3pysal2' due to an error when calling its classFactory() method"
I then followed the code you provided above and this was the result:
import pysal
Traceback (most recent call last):
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/code.py", line 90, in runcode
exec(code, self.locals)
File "", line 1, in
I'm very confused about what to do. I am sure the problem is with something that I am doing wrong, but I am unsure what it is. I am running this on a Mac on OS X 10.15.7 and using QGIS 13.6.5. Any help is appreciated. I was using the hotspot analysis plugin successfully about a month ago and now I am not having any luck.
Based on the issues I had with this package (and if I am reading your errors correctly), I think your problems are:
pip3 install pysal==2.0
pip3 show pysal
Again, I am not super well versed in code for python so there might be a much simpler way to do this than I am doing it, but it worked for me. @danioxoli, please feel free to correct me if you think anything I said above is incorrect.
Hope this helps!
Dear all, the manual solution proposed by @dbrosi worked also in my test. However, it is not much safe to move Py packages manually in general...
@samueledward1997, if both the solutions proposed in the readme and the manual one fail, try out to set QGIS paths to the package folder manually to be sure that the wanted packages are within the same python env used by QGIS (see: https://gis.stackexchange.com/questions/351280/installing-python-modules-for-qgis-3-on-mac)
Best
Hi Everyone!
I am a very beginner coder and I am trying to install the HotSpot Analysis Plugin. I seem to be having some trouble beyond installing the correct pysal version and think it might be based on the pathname where QGIS is trying to call the python/pysal package. I went through all the steps posted on how to get the 1.4.3 version of pysal, but still with the same warning message from QGIS. Here is what my terminal says when I check what version of pysal I have:
Name: PySAL Version: 1.14.3 Summary: A library of spatial analysis functions. Home-page: http://pysal.org Author: None Author-email: None License: BSD Location: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages Requires: scipy, numpy Required-by:
I even tried uploading the pysal file to the folder path that QGIS uses, but then just started hitting roadblocks of it not encountering other "modules" in that folder.
I am wondering if someone can help me figure out how to get QGIS to read the right pysal location for macOS? In terminal it says that the pysal package is located under /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages and my QGIS is mapping to /Applications/QGIS.app/Contents/Resources/python. I looked at other forums where they talk about code to change the PYTHONPATH - but none of them worked and I always ended up with error messages in either terminal or QGIS console.
Just for reference here is the error message I get and why I think that it is a problem with the pathname.
Couldn't load plugin 'HotspotAnalysis' due to an error when calling its classFactory() method
ModuleNotFoundError: No module named 'pysal.esda' 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/deenabrosi/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 792, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Users/deenabrosi/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/HotspotAnalysis/hotspot_analysis.py", line 39, in from pysal.esda.getisord import * File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'pysal.esda'
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.4-Hannover Hannover, 81ba6c0826
Python Path: /Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python
Any help is very much appreciated!