danioxoli / HotSpotAnalysis_Plugin

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

ModuleNotFoundError: No module named 'Shape' #48

Closed Margaux-Julien closed 4 years ago

Margaux-Julien commented 4 years ago

Hello, I'm trying to install the plugin. I'm using a window machine with QGIS version 3.8. I'm getting the following error :

Traceback (most recent call last):
  File "C:/PROGRA~1/QGIS3~1.8/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:/Users/PC-03/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.8/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Users/PC-03/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 38, in 
    import pysal
  File "C:/PROGRA~1/QGIS3~1.8/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\pysal\__init__.py", line 40, in 
    import pysal.cg
  File "C:/PROGRA~1/QGIS3~1.8/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\pysal\cg\__init__.py", line 4, in 
    from shapes import *
  File "C:/PROGRA~1/QGIS3~1.8/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\shapes\__init__.py", line 1, in 
    from Shape import Shape
  File "C:/PROGRA~1/QGIS3~1.8/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'Shape'

I tried to install the module Shape and it succeed but I have the same error. numpy and scipy are correctly installed, but I had an error with pysal :

> ERROR: Command errored out with exit status 1:
>    command: 'c:\progra~1\qgis3~1.8\apps\python37\python.exe' 'C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\PC-03\AppData\Local\Temp\tmp4qiwaecr'
>        cwd: C:\Users\PC-03\AppData\Local\Temp\pip-install-10xm4ika\rasterio
>   Complete output (2 lines):
>   INFO:root:Building on Windows requires extra options to setup.py to locate needed GDAL files. More information is available in the README.
>   ERROR: A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
>   ----------------------------------------
> ERROR: Command errored out with exit status 1: 'c:\progra~1\qgis3~1.8\apps\python37\python.exe' 'C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\PC-03\AppData\Local\Temp\tmp4qiwaecr' Check the logs for full command output.

I used "pip install --no-cache-dir pysal" to install pysal.

I read many issues here but I didn't find a solution :(

Any help would be appreciated !

danioxoli commented 4 years ago

Dear Margaux,

Thank you for reporting.

I'm noticing issues with the GDAL-API on QGIS 3.8. Please check the answer to issue #47 that may help you in solving this.

Best, Daniele

Margaux-Julien commented 4 years ago

Thanks for your response.

I downloaded QGIS 3.10 and I succeed to install pysal.

But I still have the first error : "ModuleNotFoundError: No module named 'Shape'". Do you have an idea for this ?

danioxoli commented 4 years ago

Dear Margaux,

have you followed this installation pattern (suggested in the README file) on the new QGIS version?

Open OSGeo4W Shell as administrator and type: py3_env.bat python3 -m pip uninstall pysal (to be sure that any former pysal version is removed) python3 -m pip install --upgrade pip python3 -m pip install pysal==1.14.3 --yourwindowsusername

The current plugin works on pysal <=1.14.3. Without specifying the version, the pip installs pysal =2.XX wich may cause some of your errors. Give a try and let me know if this workaround was helpful.

Best, Daniele

Margaux-Julien commented 4 years ago

It works !! Thank you a lot :)