Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to install UMEP Plugin in QGIS (MacBookPro) #240

Closed
helenwillems opened this issue Mar 3, 2021 · 27 comments
Closed

Error when trying to install UMEP Plugin in QGIS (MacBookPro) #240

helenwillems opened this issue Mar 3, 2021 · 27 comments

Comments

@helenwillems
Copy link

helenwillems commented Mar 3, 2021

Specs.: macOS Catalina Version 10.15.3, MacBook Pro (16-inch, 2019)

Error log:
Konnte Erweiterung 'UMEP' nicht laden aufgrund eines Fehlers beim Aufruf der classFactory() Methode 

ModuleNotFoundError: No module named 'osr' 
Traceback (most recent call last):
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 334, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP/__init__.py", line 34, in classFactory
    from .UMEP import UMEP
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP/UMEP.py", line 42, in 
    from .UMEPDownloader.umep_downloader import UMEP_Data_Download
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP/UMEPDownloader/umep_downloader.py", line 41, in 
    import osr
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'osr'


Python-Version: 3.8.7 (default, Feb 10 2021, 09:04:08) [Clang 12.0.0 (clang-1200.0.32.29)] 
QGIS-Version: 3.16.4-Hannover Hannover, 81ba6c0826 

Python-Pfad:
/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python
/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/plugins
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numba-0.50.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/patsy-0.5.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/lib-dynload
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Rtree-0.9.4-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/geopandas-0.8.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/scipy-1.5.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pandas-1.1.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/statsmodels-0.11.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/rasterio-1.1.5-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Fiona-1.8.13.post1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/opencv_contrib_python-4.3.0.36-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pyproj-2.6.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/netCDF4-1.5.4-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/GDAL-3.2.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numpy-1.20.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/click_plugins-1.1.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/affine-2.3.0-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/cftime-1.2.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python38.zip
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/snuggs-1.4.7-py3.8.egg
/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python

Anyone an idea what it is about the osr module?
Thx for any suggestions..

cheers Helen

@biglimp
Copy link
Contributor

biglimp commented Mar 3, 2021

osr is a common library connected to gdal. Should be present if gdal is functioning proparly. This seems to be a Mac-related issue. @sunt05 , do you have any idea?

@sunt05
Copy link
Contributor

sunt05 commented Mar 3, 2021

Could be a bug introduced by the upstream package:

OSGeo/gdal#3149

We might need to fix this by changing import osr to from osgeo import osr.

@helenwillems Can you please test in the QGIS python console if the following works:
from osgeo import osr

If so, then we can try a fix at the UMEP side. Otherwise, it could be that your QGIS installation was not properly done.

@sunt05
Copy link
Contributor

sunt05 commented Mar 3, 2021

And this comment OSGeo/gdal#3149 (comment) might be useful @biglimp

@helenwillems
Copy link
Author

helenwillems commented Mar 4, 2021

@sunt05 I changed import osr (and import ogr) to from osgeo import osr (ogr) and now get the following error message:

Konnte Erweiterung 'UMEP' nicht laden aufgrund eines Fehlers beim Aufruf der classFactory() Methode 

ImportError: dlopen(/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so, 2): Library not loaded: /opt/X11/lib/libxcb.1.dylib   Referenced from: /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so   Reason: image not found 
Traceback (most recent call last):
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 334, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP/__init__.py", line 34, in classFactory
    from .UMEP import UMEP
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP/UMEP.py", line 61, in 
    from .SEBEVisual.sun import Visual
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP/SEBEVisual/sun.py", line 49, in 
    from matplotlib.figure import Figure
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/figure.py", line 18, in 
    from matplotlib import docstring, projections
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/projections/__init__.py", line 1, in 
    from .. import axes, docstring
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/axes/__init__.py", line 1, in 
    from ._subplots import *
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/axes/_subplots.py", line 6, in 
    from matplotlib.axes._axes import Axes
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/axes/_axes.py", line 14, in 
    import matplotlib.contour as mcontour
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/contour.py", line 17, in 
    import matplotlib.text as text
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/text.py", line 16, in 
    from .textpath import TextPath  # Unused, but imported by others.
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/textpath.py", line 11, in 
    from matplotlib.mathtext import MathTextParser
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/mathtext.py", line 27, in 
    from PIL import Image
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/Image.py", line 94, in 
    from . import _imaging as core
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: dlopen(/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so, 2): Library not loaded: /opt/X11/lib/libxcb.1.dylib
  Referenced from: /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so
  Reason: image not found


Python-Version: 3.8.7 (default, Feb 10 2021, 09:04:08) [Clang 12.0.0 (clang-1200.0.32.29)] 
QGIS-Version: 3.16.4-Hannover Hannover, 81ba6c0826 

Python-Pfad:
/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP/SUEWSPrepare/Modules
/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python
/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/plugins
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/patsy-0.5.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/statsmodels-0.11.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pandas-1.1.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/rasterio-1.1.5-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python38.zip
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/GDAL-3.2.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Fiona-1.8.13.post1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/opencv_contrib_python-4.3.0.36-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Rtree-0.9.4-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numba-0.50.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/affine-2.3.0-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pyproj-2.6.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/lib-dynload
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/cftime-1.2.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numpy-1.20.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/snuggs-1.4.7-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/scipy-1.5.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/netCDF4-1.5.4-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/click_plugins-1.1.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/geopandas-0.8.1-py3.8.egg
/Users/helenwillems/Library/Application Support/QGIS/QGIS3/profiles/default/python

@sunt05
Copy link
Contributor

sunt05 commented Mar 4, 2021

It looks your QGIS installation is broken.
and this has nothing to do with UMEP.

Maybe reinstall QGIS and try again.

@helenwillems
Copy link
Author

I'll try.
@sunt05 Will you anyway try a fix at the UMEP side concerning import osr and import ogr to from osgeo import ... ?

@sunt05
Copy link
Contributor

sunt05 commented Mar 4, 2021

@helenwillems yes, we'll do once this error is better understood.

@sunt05
Copy link
Contributor

sunt05 commented Mar 4, 2021

@biglimp it seems I can use both import osr and from osgeo import osr in QGIS 3.16.

And based on the GDAL API page, the API has long been flavoured as from osgeo import ...: the import osr/ogr style could just be a deprecated way we have been ignoring?

so I think at least we should try to use try for both flavours as new users may undergo the same issue here.

@biglimp
Copy link
Contributor

biglimp commented Mar 4, 2021

In 3.18 as well (both can be used). Lets change to from osgeo import ...

@rarygit
Copy link

rarygit commented Mar 5, 2021

Error also occurs using Ubuntu 20.04 and QGIS v3.18.

UMEP installed/loaded when I commented out in UMEP.py:

from .UMEPDownloader.umep_downloader import UMEP_Data_Download
from .DSMGenerator.dsm_generator import DSMGenerator

@biglimp
Copy link
Contributor

biglimp commented Mar 5, 2021

@rarygit
Copy link

rarygit commented Mar 5, 2021

UMEP 3.16.1 opened OK in QGIS 3.18

But "SUEWS Prepare" did not work: AttributeError: module 'time' has no attribute 'clock'

2021-03-05T16:42:14 WARNING Traceback (most recent call last):
File "/home/l1nux/.local/share/QGIS/QGIS3/profiles/default/python/plugins/UMEP/UMEP.py", line 411, in SUEWS_Prepare
sg = SUEWSPrepare(self.iface)
File "/home/l1nux/.local/share/QGIS/QGIS3/profiles/default/python/plugins/UMEP/SUEWSPrepare/suews_prepare.py", line 148, in init
self.data = xlrd.open_workbook(self.file_path)
File "/home/l1nux/.local/share/QGIS/QGIS3/profiles/default/python/plugins/UMEP/SUEWSPrepare/Modules/xlrd/init.py", line 148, in open_workbook
bk = book.open_workbook_xls(
File "/home/l1nux/.local/share/QGIS/QGIS3/profiles/default/python/plugins/UMEP/SUEWSPrepare/Modules/xlrd/book.py", line 70, in open_workbook_xls
t0 = time.clock()
AttributeError: module 'time' has no attribute 'clock'

@rarygit
Copy link

rarygit commented Mar 5, 2021

import time
t0 = time.clock()

Does this mean something? Deprecated Function: time.clock()
https://www.python.org/dev/peps/pep-0418/#time-clock

@rarygit
Copy link

rarygit commented Mar 5, 2021

Now works by adding this to book.py:

try:
from time import perf_counter
except ImportError:
# Python 2.7
from time import clock as perf_counter

and replacing time.clock() with perf_counter

as attached, book.py that I used

book_py_.txt

@helenwillems
Copy link
Author

Try now with new version 3.16.1 (development release). https://umep-docs.readthedocs.io/en/latest/Getting_Started.html#installing-development-release-could-be-unstable

@biglimp: really sorry for my stupid questions.., but I am not even successful downloading UMEP from a zip file.
first: the "download zip" doesn't give me a zip but a usual folder. Do I have to make a zip or just use the usual folder?

and then: I don't know what it means: The main branch at the moment is SuPy-QGIS3. Probably something where I should locate the zip (or the usual folder)?! can you please give me a hint (or two..)?

@biglimp
Copy link
Contributor

biglimp commented Mar 8, 2021

No worries. We should make the instructions more clear on our webpage.

  • When you located our code repository, click the green button (Code) and choose to download as zip-file. Since SyPy-QGIS3 is our main branch at the moment, you dont have to do anything else.
  • after that you can follow the instructions from the link I presented in the previous comment (from step 2).

Let me know if you have any issues.

@helenwillems
Copy link
Author

@biglimp: thx for your patient.. When I choose download as zip-file, it gives me no zip file, but a usual folder called "UMEP-SuPy-QGIS3" with subfolders etc. and then when I try to install the UMEP plugin in QGIS from a ZIP, I can't choose this folder "UMEP-SuPy-QGIS3" (prob bc its no zip file?!). I also tried to make a zip from the "UMEP-SuPy-QGIS3" folder on my own, but when I choose that zip-file in QGIS, it gives me the error: "Die ZIP-Datei ist keine gültige QGIS-Pythonerweiterung. Kein Wurzelverzeichnis wurde darin gefunden." like - this zip file is no valid QGIS-python-add-on. No root directory found..

@biglimp
Copy link
Contributor

biglimp commented Mar 9, 2021

Just to confirm, You are clicking on the Download Zip shown in the screendump below? If yes, I cannot really replicate this. I am getting a zip file which works in QGIS Plugin Manager.

I attach my zip-file for you to use.
UMEP-SuPy-QGIS3.zip

image

@helenwillems
Copy link
Author

Yes. Was just the same with your zip-file.. Now I got the problem. It was the automatic unzip function in safari browser that didn't give me the zip-file... Now it works.

@cdbell01
Copy link

cdbell01 commented Mar 10, 2021

I am also a mac user, new to QGIS and UMEP. I am having a similar issue with the UMEP plug-in install. I've tried re-installing QGIS (v 3.16.4-Hannover) and then installing the UMEP plug-in from the zip file on github. Still not working. Here's the error:

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

ImportError: dlopen(/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so, 2): Library not loaded: /opt/X11/lib/libxcb.1.dylib   Referenced from: /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so   Reason: image not found 
Traceback (most recent call last):
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 334, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/Users/colinbell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-SuPy-QGIS3/__init__.py", line 34, in classFactory
    from .UMEP import UMEP
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/colinbell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-SuPy-QGIS3/UMEP.py", line 61, in 
    from .SEBEVisual.sun import Visual
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/colinbell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-SuPy-QGIS3/SEBEVisual/sun.py", line 49, in 
    from matplotlib.figure import Figure
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/figure.py", line 18, in 
    from matplotlib import docstring, projections
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/projections/__init__.py", line 1, in 
    from .. import axes, docstring
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/axes/__init__.py", line 1, in 
    from ._subplots import *
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/axes/_subplots.py", line 6, in 
    from matplotlib.axes._axes import Axes
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/axes/_axes.py", line 14, in 
    import matplotlib.contour as mcontour
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/contour.py", line 17, in 
    import matplotlib.text as text
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/text.py", line 16, in 
    from .textpath import TextPath  # Unused, but imported by others.
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/textpath.py", line 11, in 
    from matplotlib.mathtext import MathTextParser
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/mathtext.py", line 27, in 
    from PIL import Image
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/Image.py", line 94, in 
    from . import _imaging as core
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: dlopen(/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so, 2): Library not loaded: /opt/X11/lib/libxcb.1.dylib
  Referenced from: /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so
  Reason: image not found


Python version: 3.8.7 (default, Feb 10 2021, 09:04:08) [Clang 12.0.0 (clang-1200.0.32.29)] 
QGIS version: 3.16.4-Hannover Hannover, 81ba6c0826 

Python Path:
/Users/colinbell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-SuPy-QGIS3/SUEWSPrepare/Modules
/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python
/Users/colinbell/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/colinbell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/plugins
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pandas-1.1.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/geopandas-0.8.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/scipy-1.5.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/opencv_contrib_python-4.3.0.36-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/lib-dynload
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numpy-1.20.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python38.zip
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/snuggs-1.4.7-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/affine-2.3.0-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numba-0.50.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/GDAL-3.2.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/netCDF4-1.5.4-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/rasterio-1.1.5-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/statsmodels-0.11.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Rtree-0.9.4-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/cftime-1.2.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Fiona-1.8.13.post1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pyproj-2.6.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/click_plugins-1.1.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/patsy-0.5.1-py3.8.egg
/Users/colinbell/Library/Application Support/QGIS/QGIS3/profiles/default/python

@sunt05
Copy link
Contributor

sunt05 commented Mar 11, 2021

@cdbell01 might be useful if you don't have XQuartz installed:
OpenKinect/libfreenect#503 (comment)

@cdbell01
Copy link

cdbell01 commented Mar 11, 2021

@sunt05 Thank you for the response.
Installing XQuartz did not solve the issue. If I install UMEP from the plug-in menu in QGIS, I get the same error message first reported here:

Couldn't load plugin 'UMEP' due to an error when calling its classFactory() method 
ModuleNotFoundError: No module named 'osr' 

When I install it from the .zip file, I do not get a specific error message, just a notification that it failed. Did installing from the .zip solve @helenwillems issue?

I've tried uninstalling/reinstalling QGIS a few times.

@helenwillems
Copy link
Author

@cdbell01 For me it works now. But I first did a system upgrade to MacOS Big Sur, then completely deinstalled and reinstalled QGIS 3.16.4 Hannover and then load the UMEP from the .zip file.

@cdbell01
Copy link

Yes! Got the UMEP plug-in to work after uninstall/reinstall of QGIS and loading the plug in from the .zip file posted to this thread. Not sure what was different about my 5th uninstall/re-install of QGIS 3.16.4 - but happy it's working. Thanks so much everybody - you have an amazing community here.

@sunt05
Copy link
Contributor

sunt05 commented Mar 13, 2021

glad to see the issue has been resolved.

However, here I just want to clarify several points:
1.

Installing XQuartz did not solve the issue. If I install UMEP from the plug-in menu in QGIS, I get the same error message first reported here:

Couldn't load plugin 'UMEP' due to an error when calling its classFactory() method 
ModuleNotFoundError: No module named 'osr' 

Apparently, installing XQuartz did help as the issue here is actually a new one and not related to the one originally reported.

  1. the osr issue is a known issue that should have been resolved but might not get updated in the QGIS plugin repo.

@sunt05
Copy link
Contributor

sunt05 commented Mar 13, 2021

@cdbell01 please consider closing this issue if things are working now. thanks!

@cdbell01
Copy link

@sunt05 I think it is @helenwillems issue to close. Thanks again.

@sunt05 sunt05 closed this as completed Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants