UMEP-dev / UMEP-processing

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

Error when install Python Packages for UMEP #48

Closed evbla closed 7 months ago

evbla commented 1 year ago

Hej!

When launching UMEP for processing, it requires the download of new Python packages. Once this is completed, the following error message occurs:

AttributeError: module 'numpy' has no attribute 'long' Traceback (most recent call last): File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 423, in _startPlugin plugins[packageName] = package.classFactory(iface) File "C:\Users/beam0/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep__init.py", line 46, in classFactory from .processing_umep import ProcessingUMEPPlugin File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/beam0/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\processing_umep.py", line 38, in from .processing_umep_provider import ProcessingUMEPProvider File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/beam0/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\processing_umep_provider.py", line 54, in from .processor.urock_processing_algorithm import URockAlgorithm File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/beam0/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\processor\urock_processing_algorithm.py", line 64, in from ..functions.URock import MainCalculation File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/beam0/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\functions\URock\MainCalculation.py", line 19, in from . import WindSolver File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/beam0/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\functions\URock\WindSolver.py", line 18, in from numba import jit File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\OSGeo4W\apps\Python39\lib\site-packages\numba__init__.py", line 18, in from numba.core import types, errors File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtinimport(name, globals, locals, fromlist, level) File "C:\OSGeo4W\apps\Python39\lib\site-packages\numba\core\types__init__.py", line 108, in long = _make_signed(np.long) File "C:\OSGeo4W\apps\Python39\lib\site-packages\numpy\init.py", line 284, in getattr__ raise AttributeError("module {!r} has no attribute " AttributeError: module 'numpy' has no attribute 'long'

When I choose to cancel the installation of new Python packages, the same message reappears.

Regards, Evelina

biglimp commented 1 year ago

Evelina, write the following code in your QGIS Python console and report the result. @j3r3m1 , do you have any ideas on how to solve this? I know Evelina have another Python installation (3.11) on her computer also.

import numpy
numpy.__version__

import numba
numba.__version__
evbla commented 1 year ago

Numpy version: 1.24.1

Numba version:

Traceback (most recent call last): File "C:\OSGeo4W\apps\Python39\lib\code.py", line 90, in runcode exec(code, self.locals) File "", line 1, in File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\OSGeo4W\apps\Python39\lib\site-packages\numba__init.py", line 18, in from numba.core import types, errors File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtinimport(name, globals, locals, fromlist, level) File "C:\OSGeo4W\apps\Python39\lib\site-packages\numba\core\types__init__.py", line 108, in long = _make_signed(np.long) File "C:\OSGeo4W\apps\Python39\lib\site-packages\numpy\init.py", line 284, in getattr__ raise AttributeError("module {!r} has no attribute " AttributeError: module 'numpy' has no attribute 'long'

Does some of the versions of numpy not support numba?

j3r3m1 commented 1 year ago

It seems this problem has been met in two other issues previously: #543 and #30

It has been resolved using a Numpy version lower than 1.24.

Maybe we should specify the numpy library to be used ?

evbla commented 1 year ago

I changed the numpy version to 1.23.3 and it works now! I think it is good to specify the type of numba library used.

j3r3m1 commented 1 year ago

What is the numba version you are using ? Can you check using pip list and checking the version associated to numba ?

Here are the numba versions and the corresponding numpy dependency: https://numba.readthedocs.io/en/stable/user/installing.html#version-support-information

I do not really know why the numba version installed is not directly the right one (associated to the numpy dependency). Is it the first time you install UMEP ? If yes it might be that we do not check that the numba version installed works for the installed numpy version. Should we add a way to check that

evbla commented 1 year ago

I am using numba version 0.56.4. And no it is not the first time using UMEP.

j3r3m1 commented 1 year ago

Do you remember when was the last time you updated the UMEP-processing plugin ? I suppose the problem comes from the fact that your numpy version was updated (outside UMEP update) but that the last update you made of UMEP created the version conflict...

biglimp commented 7 months ago

As this seems solved, I will close this.