UMEP-dev / UMEP-processing

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

ImportError: C extension On MacOS Monterey #40

Closed gusbacos closed 1 year ago

gusbacos commented 1 year ago

Hi,

Import error when installing UMEP for Processing on MacOS

Couldn't load plugin 'UMEP' due to an error when calling its classFactory() method ImportError: C extension: None not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext' to build the C extensions first. Traceback (most recent call last): File "/Users/gast/.local/lib/python3.9/site-packages/pandas/init.py", line 23, in from pandas.compat import ( 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/gast/.local/lib/python3.9/site-packages/pandas/compat/init.py", line 26, in from pandas.compat.numpy import is_numpy_dev 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/gast/.local/lib/python3.9/site-packages/pandas/compat/numpy/init.py", line 17, in raise ImportError( ImportError: this version of pandas is incompatible with numpy your numpy version is 1.20.1. Please upgrade numpy to >= 1.22.4 to use this pandas version

The above exception was the direct cause of the following exception:

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/gast/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP/init.py", line 34, in classFactory from .UMEP import UMEP 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/gast/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP/UMEP.py", line 44, in from .UWGReClassifier.uwg_reclassifier import uwg_reclassifier 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/gast/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP/UWGReClassifier/uwg_reclassifier.py", line 36, in import pandas as pd 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/gast/.local/lib/python3.9/site-packages/pandas/init.py", line 28, in raise ImportError( ImportError: C extension: None not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext' to build the C extensions first.

Python version: 3.9.5 (default, Sep 10 2021, 16:18:19) [Clang 12.0.5 (clang-1205.0.22.11)] QGIS version: 3.32.3-Lima Lima, 67d46100b5b Python Path: • /Applications/QGIS.app/Contents/MacOS/../Resources/python • /Users/gast/Library/Application Support/QGIS/QGIS3/profiles/default/python • /Users/gast/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 • /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/Rtree-0.9.7-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/patsy-0.5.1-py3.9.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 • /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/numpy-1.20.1-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/scipy-1.5.1-py3.9-macosx-10.13.0-x86_64.egg • /Users/gast/.local/lib/python3.9/site-packages • /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/geopandas-0.8.1-py3.9.egg • /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/rasterio-1.1.5-py3.9-macosx-10.13.0-x86_64.egg • /Applications/QGIS.app/Contents/MacOS/lib/python3.9/site-packages/Fiona-1.8.13.post1-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 • /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/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/matplotlib-3.3.0-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 • /Users/gast/Library/Application Support/QGIS/QGIS3/profiles/default/python

biglimp commented 1 year ago

Looks you have a version conflict between numpy and pandas. Try to upgrade.

conichow2001 commented 1 year ago

Looks you have a version conflict between numpy and pandas. Try to upgrade.

Hii I have a similar issue. When I upgrade pandas to use UMEP, I was told the following and therefore cannot use UMEP for processing.

module 'numpy' has no attribute 'long'

However, if I install an older version of numpy, as I was told 'long' has been deprecated in numpy 1.20, I could not use UMEP and UMEP for processing as I need to upgrade my python libraries.

Would you know how to solve it?

biglimp commented 1 year ago

Have a look at this Discussion. https://github.com/UMEP-dev/UMEP/issues/543