PUTvision / qgis-plugin-deepness

Deepness is a remote sensing plugin that enables deep learning inference in QGIS
https://www.buymeacoffee.com/deepness
Apache License 2.0
108 stars 25 forks source link

Installation errors #92

Closed max-mapper closed 1 year ago

max-mapper commented 1 year ago

I am using latest QGIS and Python in Arch Linux. First I had to uncomment these lines to get the installation window to show because lsb_release.py is not present in newer pythons:

opencv_version = '4.6.0.66'
# if sys.platform == "linux" or sys.platform == "linux2":
#     import lsb_release
#     if lsb_release.get_os_release()['CODENAME'] == 'focal':
#         opencv_version = '4.5.5.64'

Then when I tried to install the dependencies I got this error:

Python packages required by the plugin could not be loaded due to the following error: 
Traceback (most recent call last):
  File "/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/dialogs/packages_installer/packages_installer_dialog.py", line 278, in _check_packages_installation_and_log
    import_packages()
  File "/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/dialogs/packages_installer/packages_installer_dialog.py", line 303, in import_packages
    import_package(package)
  File "/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/dialogs/packages_installer/packages_installer_dialog.py", line 298, in import_package
    importlib.import_module(package.import_name)
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "", line 1206, in _gcd_import
  File "", line 1178, in _find_and_load
  File "", line 1149, in _find_and_load_unlocked
  File "", line 690, in _load_unlocked
  File "", line 940, in exec_module
  File "", line 241, in _call_with_frames_removed
  File "/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/python3.11/onnxruntime/__init__.py", line 55, in 
    raise import_capi_exception
  File "/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/python3.11/onnxruntime/__init__.py", line 23, in 
    from onnxruntime.capi._pybind_state import (
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/python3.11/onnxruntime/capi/_pybind_state.py", line 32, in 
    from .onnxruntime_pybind11_state import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'onnxruntime.capi.onnxruntime_pybind11_state'

Please try installing the packages again.
przemyslaw-aszkowski commented 1 year ago

Hi, thanks for reporting. Unfortunately I do not have a quick fix for this issue, we would need to debug it on arch linux first. If you are willing to investigate, please have a look at the file packages_installer_dialog.py. What is happening there, is just installation of two packages, onnxruntime-gpu and opencv-python-headless. You can try installing it manually in the environment which QGIS is using (most probably the global one) and check if the installation of these packages will succeed. Hope it will help!

max-mapper commented 1 year ago

Thank you. Installing qgis through conda seemed to fix the onnxruntime issues:

conda create -n qgis python=3.8
conda install -c conda-forge qgis
qgis

But I still receive this error when starting up:

Couldn't load plugin 'deepness' due to an error when calling its classFactory() method 

ModuleNotFoundError: No module named 'lsb_release' 
Traceback (most recent call last):
  File "/home/max/miniconda3/envs/qgis/share/qgis/python/qgis/utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/__init__.py", line 15, in classFactory
    from deepness.dialogs.packages_installer import packages_installer_dialog
  File "/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ee_plugin/__init__.py", line 38, in __wrapping_ee_import__
    _module_ = __builtin_import__(name, *args, **kwargs)
  File "/home/max/miniconda3/envs/qgis/share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/dialogs/packages_installer/packages_installer_dialog.py", line 52, in 
    import lsb_release
  File "/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ee_plugin/__init__.py", line 38, in __wrapping_ee_import__
    _module_ = __builtin_import__(name, *args, **kwargs)
  File "/home/max/miniconda3/envs/qgis/share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'lsb_release'

Python version: 3.8.17 (default, Jul  5 2023, 21:12:12) [GCC 11.2.0] 
QGIS version: 3.32.0-Lima Lima, exported 

Python Path:
/home/max/miniconda3/envs/qgis/share/qgis/python
/home/max/.local/share/QGIS/QGIS3/profiles/default/python
/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/home/max/miniconda3/envs/qgis/share/qgis/python/plugins
/home/max/miniconda3/envs/qgis/share/qgis/python/plugins
/home/max/miniconda3/envs/qgis/share/qgis/python
/home/max
/home/max/miniconda3/envs/qgis/lib/python38.zip
/home/max/miniconda3/envs/qgis/lib/python3.8
/home/max/miniconda3/envs/qgis/lib/python3.8/lib-dynload
/home/max/miniconda3/envs/qgis/lib/python3.8/site-packages
/home/max/.local/share/QGIS/QGIS3/profiles/default/python
/home/max
/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis2web
/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ee_plugin/extlibs_linux
/home/max/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs
przemyslaw-aszkowski commented 1 year ago

Hi, Thanks for your feedback. We use the lsb_release to check the OS to change versions of some packages. I hope I fixed your issue in PR #100. You can apply these changes to your code or download the latest built artefact with this fix (https://github.com/PUTvision/qgis-plugin-deepness/actions/runs/5655369998). I hope it helps Przemek