coolzhao / Geo-SAM

A QGIS plugin tool using Segment Anything Model (SAM) to accelerate segmenting or delineating landforms in geospatial raster images.
MIT License
199 stars 26 forks source link

ModuleNotFoundError: No module named 'rasterio' #23

Open mikdotou opened 9 months ago

mikdotou commented 9 months ago

When I finish installation I get this error.

_``` Impossible de charger l'extension 'Geo-SAM'

ModuleNotFoundError: No module named 'rasterio' Traceback (most recent call last): File "C:\PROGRA~1/QGIS32~1.10/apps/qgis-ltr/./python\qgis\utils.py", line 401, in loadPlugin import(packageName) File "C:\PROGRA~1/QGIS32~1.10/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/Admin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo-SAM__init__.py", line 7, in from .geo_sam_tool import Geo_SAM File "C:\PROGRA~1/QGIS32~1.10/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/Admin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo-SAM\geo_sam_tool.py", line 24, in from .tools.SAMTool import SAM_Model File "C:\PROGRA~1/QGIS32~1.10/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/Admin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo-SAM\tools\SAMTool.py", line 7, in import rasterio File "C:\PROGRA~1/QGIS32~1.10/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'rasterio'



Could you help me to fix it ?
Thanks
Fanchengyan commented 9 months ago

Hi @mikdotou. Sorry for the late response. Have you installed dependencies? rasterio should be installed after installing torchgeo . If not, please follow the tutorial step-by-step to install them: https://geo-sam.readthedocs.io/en/latest/Installation.html#install-library-dependencies

aobrien-fo commented 8 months ago

I had the same issue. In my case, I mistakenly installed the dependencies using the Windows 'Powershell', which installed the packages to my OS environment (Python 3.11 in my case).

However, QGIS is using Python 3.9... so I was getting the 'module not found error'. Check your error further, and you will notice which version of Python QGIS is using.

My solution was to open the OSGeo4W Shell and install the necessary dependencies there using $ python -m pip install torch torchvision.