UMEP-dev / UMEP-processing

7 stars 9 forks source link

Numpy error on startup #30

Closed dawgermany closed 12 months ago

dawgermany commented 1 year ago

Hi, in order to run UMEP i had to upgrade my numpy. Now the conflicting versions error has gone and another error has appeared. MacOS 12.5 QGIS: 3.30.3 Numpy: 1.25.0

I first tried the latest version of the plugin from the qgis plugin-repo; after that didnt work i got the zip of this repo and installed it manually. Is there some way in which i can use UMEP-processing? i need it because the pre-processors "Tree Generator" & "Sky View Factor" are only available in the processing version.

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

AttributeError: module 'numpy' has no attribute 'long' Traceback (most recent call last): File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 423, in _startPlugin plugins[packageName] = package.classFactory(iface) File "/Users/USR-NAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/init.py", line 38, in classFactory from .processing_umep import ProcessingUMEPPlugin File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Users/USR-NAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/processing_umep.py", line 38, in from .processing_umep_provider import ProcessingUMEPProvider File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Users/USR-NAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/processing_umep_provider.py", line 54, in from .processor.urock_processing_algorithm import URockAlgorithm File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Users/USR-NAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/processor/urock_processing_algorithm.py", line 63, in from ..functions.URock import MainCalculation File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Users/USR-NAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/functions/URock/MainCalculation.py", line 19, in from . import WindSolver File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Users/USR-NAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/functions/URock/WindSolver.py", line 18, in from numba import jit File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/numba-0.50.1-py3.9-macosx-10.13.0-x86_64.egg/numba/init.py", line 16, in from numba.core import types, errors File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/numba-0.50.1-py3.9-macosx-10.13.0-x8664.egg/numba/core/types/init.py", line 108, in long = _make_signed(np.long) File "/Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/numpy/init.py", line 322, in getattr raise AttributeError("module {!r} has no attribute " AttributeError: module 'numpy' has no attribute 'long'

Python version: 3.9.5 (default, Sep 10 2021, 16:18:19) [Clang 12.0.5 (clang-1205.0.22.11)] QGIS version: 3.30.3-'s-Hertogenbosch 's-Hertogenbosch, 2411cec112

Python Path: /Users/USR-NAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP/SUEWSPrepare/Modules /Applications/QGIS.app/Contents/MacOS/../Resources/python /Users/USR-NAME/Library/Application Support/QGIS/QGIS3/profiles/default/python /Users/USR-NAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins /Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/statsmodels-0.11.1-py3.9-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.9 /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/Rtree-0.9.7-py3.9-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/cftime-1.2.1-py3.9-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/GDAL-3.3.2-py3.9-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/pandas-1.3.3-py3.9-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.9/lib-dynload /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/opencv_contrib_python-4.3.0.36-py3.9-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/netCDF4-1.5.4-py3.9-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/Pillow-7.2.0-py3.9-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/scipy-1.5.1-py3.9-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/patsy-0.5.1-py3.9.egg /Users/USR-NAME/.local/lib/python3.9/site-packages /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/matplotlib-3.3.0-py3.9-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python39.zip /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/numba-0.50.1-py3.9-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/pyproj-3.2.0-py3.9-macosx-10.13.0-x86_64.egg /Users/USR-NAME/Library/Application Support/QGIS/QGIS3/profiles/default/python"

j3r3m1 commented 1 year ago

Hi @dawgermany , why did you update your numpy ? Which version were you having before ? You should use a numpy version lower than 1.25 since this version is not compatible with any version of Numba yet. Can you please downgrade to a lower version (for example 1.24) and let us know if you are still facing the same issue ?

dawgermany commented 1 year ago

ok so after some hickups with different versions of numpy colliding with other parts of my setup; apparently right now the way to go is to install the latest version of numpy before "long" was deprecated in 1.24 so thats Version 1.23.3

j3r3m1 commented 1 year ago

Does it work with your 1.23.3 version ?

dawgermany commented 1 year ago

I did update my numpy because i got the error "RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe " and i was told to just pip upgrade numpy (on the internet)

Its all a bit rough on mac, as the inbuilt dependency fixer also does not work and throws an error for a missing package "jaydebeapi"

But after all I think Numpy 1.23.3 does not produce any errors in qgis 3.30.2; upgrading my numpy to 1.23.3 on the LTR of QGIS (3.28.7) does produce other errors as far as i can tell.

Thank you for the very quick reply, ironically i tried several times before today and nothing worked so sorry for the disturbance

Also i found this in a python warning panel maybe it is helpful: "DeprecationWarning: np.long is a deprecated alias for np.compat.long. To silence this warning, use np.compat.long by itself. In the likely event your code does not need to work on Python 2 you can use the builtin int for which np.compat.long is itself an alias. Doing this will not modify any behaviour and is safe. When replacing np.long, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations"

j3r3m1 commented 1 year ago

Thank you for the information. However, not sure relevant for the current code since as far as I know, np.long is not used in our code. It might be used in the Numba library, which might explain the error message.

Are you still facing an issue ? Did you try installing the jaydebeapi package by yourself ? Feel free opening new tickets if not related to numpy