danioxoli / HotSpotAnalysis_Plugin

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

classFactory() #19

Closed GiuliaT closed 5 years ago

GiuliaT commented 5 years ago

Hi Everybody,

I have followed all the instructions to install pysal, numpy and simpy to get install afterwards "Hotspot analysis" plugin in my QGIS 3.4

As you can see from this picture, everything seems to be ok:

image

But when I try to install the plugin in QGIS I get the following error:

Impossibile caricare il plugin 'HotspotAnalysis' a causa di un errore chiamando il metodo classFactory()

ModuleNotFoundError: No module named 'doctest' Traceback (most recent call last): File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\qgis\utils.py", line 335, in startPlugin plugins[packageName] = package.classFactory(iface) File "C:/Users/giugg_000/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/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/giugg_000/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/./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 40, in import pysal.cg File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./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\cg\init__.py", line 4, in from .shapes import * File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./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\cg\shapes.py", line 9, in import doctest File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'doctest'

Versione Python: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] Versione di QGIS: 3.4.1-Madeira Madeira, 383851c597

Percorso Python: C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python C:/Users/giugg_000/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/giugg_000/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/PROGRA~1/QGIS3~1.4/apps/qgis/./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\lxml-4.2.5-py3.7-win-amd64.egg 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/giugg_000/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:\Users\giugg_000\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\mmqgis/forms C:/Users/giugg_000/OneDrive - Alma Mater Studiorum Università di Bologna/PREPARAZIONE TESI A TUTTI GLI EFFETTI

Do you know how could I solve this issue? Thanks, Best Giulia

danioxoli commented 5 years ago

Ok, actually you are the second user facing this problem. Please, find here the origin of the issue.

I suggest you downgrade QGIS to version 3.2 that the problem might be due to a missing core Python class ('doctest') in the 3.4 version (using Python 3.7). Unfortunately, I cannot help you further with this specific issue as it is due to external factors. I will try to notify the errors to QGIS developers to find a solution

Thank you!

Daniele

GiuliaT commented 5 years ago

Thank you very much! I realized there was a similar question just after having send the message. I will download qgis 3.2, then.

Thank you again, Giulia

danioxoli commented 5 years ago

Let me know if this will eventually appear also on the QGIS 3.2

Best,

Daniele

abuabara commented 5 years ago

In your case, I would try to install the 'doctest' module in the same way as above. I'm using MacOS Mojave, QGIS 3.4.2 and Python 3.6.7, and I do not have this problem here. But I was helping a friend, and he had errors when trying to open his dataset, however with the test_data everything was fine. That should be some limitation or verification that the plugin does when loading.

danioxoli commented 5 years ago

The error is due to the QGIS Windows Python installation on the 3.4 version that uses Python 3.7.

Be always careful about touching core Python functions (such as the "doctest") because of the risk of corrupting the compiler grammar and not be able to run programs correctly later...

Daniele

abuabara commented 5 years ago

Hum, thanks for the heads up. On MacOS they say that just the Python 3.6.x is compatible to the QGIS installation. Not familiar with Windows.

GiuliaT commented 5 years ago

Thank you all!

I am really happy that by repeating the procedure for the QGIS 3.2 I could be finally able to install the plugin.

Thanks again, Giulia

vesnikos commented 5 years ago

Ok, actually you are the second user facing this problem. Please, find here the origin of the issue.

I suggest you downgrade QGIS to version 3.2 that the problem might be due to a missing core Python class ('doctest') in the 3.4 version (using Python 3.7). Unfortunately, I cannot help you further with this specific issue as it is due to external factors. I will try to notify the errors to QGIS developers to find a solution

Thank you!

Daniele

The latest qgis3.4/python installed from osgeo4w installer (windows) shouldn;t have any problems with doctest.

danioxoli commented 5 years ago

Dear Nikos,

Thank you, I tried on Windows and QGIS 3.4 getting the software run properly. Therefore I’ll close this issue.

Daniele