UMEP-dev / UMEP-processing

GNU General Public License v3.0
8 stars 9 forks source link

Error when first installation of UMEP #38

Closed biglimp closed 1 year ago

biglimp commented 1 year ago

This pops up when Installing UMEP for the first time. After restarting QGIS this error message goes away.

Is there anyway of including a try statement to get rid of this?

Couldn't load plugin 'UMEP-processing-main' due to an error when calling its classFactory() method 

SystemExit: 'jaydebeapi' Python package is missing 
Traceback (most recent call last):
  File "C:\Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP-processing-main\functions\URock\H2gisConnection.py", line 23, in 
    import jaydebeapi
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'jaydebeapi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:\Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP-processing-main\__init__.py", line 38, in classFactory
    from .processing_umep import ProcessingUMEPPlugin
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP-processing-main\processing_umep.py", line 38, in 
    from .processing_umep_provider import ProcessingUMEPProvider
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP-processing-main\processing_umep_provider.py", line 54, in 
    from .processor.urock_processing_algorithm import URockAlgorithm
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP-processing-main\processor\urock_processing_algorithm.py", line 63, in 
    from ..functions.URock import MainCalculation
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP-processing-main\functions\URock\MainCalculation.py", line 11, in 
    from . import H2gisConnection
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP-processing-main\functions\URock\H2gisConnection.py", line 27, in 
    exit("'jaydebeapi' Python package is missing")
  File "C:\OSGeo4W\apps\Python39\lib\_sitebuiltins.py", line 26, in __call__
    raise SystemExit(code)
SystemExit: 'jaydebeapi' Python package is missing
j3r3m1 commented 1 year ago

There is already a try / catch statement but that returns an import error (https://github.com/UMEP-dev/UMEP-processing/blob/64173c7aaec8f3d98c40ce0194f5db4eef2d0384/functions/URock/H2gisConnection.py#L24).

We might remove the ImportError and pass since the user should normally got a message if the installation of the packages failed ?

j3r3m1 commented 1 year ago

Otherwise maybe it is possible to stop the program and inform the user at the end of the installation of all needed libraries that it is needed to restart QGIS before to use UMEP ? Not sure this can work.

biglimp commented 1 year ago

pass didn't work. I am not sure how to stop the program.

Why is this happening? Is jaydebeapi dependent on something else as no other import is problematic when missing libs are installed using umep-reqs, e.g. numba and supy?

j3r3m1 commented 1 year ago

If you just except pass you get the same error ? Have you reload the plugin after that and also QGIS ?

biglimp commented 1 year ago

Yes, same error. I used a fresh computer in our studentlab so I do not have admin rights. As a work around we can inform users that they will see an error message but this will go away if the restart QGIS. One issue is that the plugin is not activated then so you need to open Manage and Install Plugins and tick in the tool to make it work.

sanvibol commented 1 year ago

I tried to restart QGIS but it is still the same error.

bweeding commented 1 year ago

Hi all, I've encountered this same error from locate_py(), due I think to the fact that my system doesn't have a value for os.environ["PYTHONHOME"], but instead has os.environ["PYTHONPATH"].

j3r3m1 commented 1 year ago

Thank you for sharing @bweeding. Have you tried modifying the locate_py to see if the error disappear ?

bweeding commented 1 year ago

It's on my to do list haha!

j3r3m1 commented 1 year ago

I have pushed a new version with the modifications for those willing to have a try: https://github.com/j3r3m1/UMEP-processing/archive/refs/heads/main.zip

bweeding commented 1 year ago

I just checked on my laptop by commenting out the code of locate_py() and setting the function to just return my local python path and QGIS loaded without error messages.

bweeding commented 1 year ago

I have pushed a new version with the modifications for those willing to have a try: https://github.com/j3r3m1/UMEP-processing/archive/refs/heads/main.zip

Ah the issue for me was in urock_processing_main. Is that deprecated now?

j3r3m1 commented 1 year ago

ha ha yes it's getting quite old now, URock is in UMEP since April 2023