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 while importing ProcessingUMEPProvider #4

Closed
nonoq opened this issue Apr 5, 2021 · 4 comments
Closed

Error while importing ProcessingUMEPProvider #4

nonoq opened this issue Apr 5, 2021 · 4 comments

Comments

@nonoq
Copy link

nonoq commented Apr 5, 2021

I am working in Spyder, Windows 10. Just following the instruction from documentation.

from qgis.core import QgsApplication
import sys

# Initiating a QGIS application
qgishome = 'C:/OSGeo4W64/apps/qgis/'
QgsApplication.setPrefixPath(qgishome, True)
app = QgsApplication([], False)
app.initQgis()

# import third party processing plugins
sys.path.append(r'C:\Users\ **your_username** \AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins')
from processing_umep.processing_umep_provider import ProcessingUMEPProvider


C:\Users\XYZ\anaconda3\envs\qgis_env\lib\site-packages\IPython\utils\_process_win32.py:145: ResourceWarning: unclosed file <_io.BufferedWriter name=4>
  return process_handler(cmd, _system_body)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\XYZ\anaconda3\envs\qgis_env\lib\site-packages\IPython\utils\_process_win32.py:145: ResourceWarning: unclosed file <_io.BufferedReader name=5>
  return process_handler(cmd, _system_body)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\XYZ\anaconda3\envs\qgis_env\lib\site-packages\IPython\utils\_process_win32.py:145: ResourceWarning: unclosed file <_io.BufferedReader name=6>
  return process_handler(cmd, _system_body)
ResourceWarning: Enable tracemalloc to get the object allocation traceback

runfile('C:/Users/XYZ/.spyder-py3/temp.py', wdir='C:/Users/XYZ/.spyder-py3')
Reloaded modules: processing_umep, processing_umep.functions.wallalgorithms, processing_umep.util, processing_umep.util.misc, processing_umep.preprocessor.wall_heightaspect_algorithm, processing_umep.util.shadowingfunctions, processing_umep.functions.svf_functions, processing_umep.preprocessor.skyviewfactor_algorithm
Traceback (most recent call last):

  File "C:\Users\XYZ\anaconda3\envs\qgis_env\lib\site-packages\pandas\core\internals\construction.py", line 568, in _list_to_arrays
    columns = _validate_or_indexify_columns(content, columns)

  File "C:\Users\XYZ\anaconda3\envs\qgis_env\lib\site-packages\pandas\core\internals\construction.py", line 692, in _validate_or_indexify_columns
    raise AssertionError(

AssertionError: 3 columns passed, passed data had 4 columns


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

Traceback (most recent call last):

  File "C:\Users\XYZ\.spyder-py3\temp.py", line 11, in <module>
    from processing_umep.processing_umep_provider import ProcessingUMEPProvider

  File "C:\Users\XYZ\anaconda3\envs\qgis_env\Library\python\qgis\utils.py", line 799, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)

  File "C:\Users\XYZ\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\processing_umep\processing_umep_provider.py", line 38, in <module>
    from .preprocessor.copernicusera5_algorithm import ProcessingCopernicusERA5Algorithm

  File "C:\Users\XYZ\anaconda3\envs\qgis_env\Library\python\qgis\utils.py", line 799, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)

  File "C:\Users\XYZ\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\processing_umep\preprocessor\copernicusera5_algorithm.py", line 64, in <module>
    import supy as sp

  File "C:\Users\XYZ\anaconda3\envs\qgis_env\Library\python\qgis\utils.py", line 799, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)

  File "C:\Users\XYZ\AppData\Roaming\Python\Python39\site-packages\supy\__init__.py", line 12, in <module>
    from .supy_module import (init_supy, load_SampleData,

  File "C:\Users\XYZ\anaconda3\envs\qgis_env\Library\python\qgis\utils.py", line 799, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)

  File "C:\Users\XYZ\AppData\Roaming\Python\Python39\site-packages\supy\supy_module.py", line 39, in <module>
    from .supy_post import pack_df_output, pack_df_output_array, pack_df_state

  File "C:\Users\XYZ\anaconda3\envs\qgis_env\Library\python\qgis\utils.py", line 799, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)

  File "C:\Users\XYZ\AppData\Roaming\Python\Python39\site-packages\supy\supy_post.py", line 23, in <module>
    var_df = get_output_info_df()

  File "C:\Users\XYZ\AppData\Roaming\Python\Python39\site-packages\supy\supy_post.py", line 14, in get_output_info_df
    df_var_list = pd.DataFrame(var_list_x, columns=['var', 'group', 'aggm'])

  File "C:\Users\XYZ\anaconda3\envs\qgis_env\lib\site-packages\pandas\core\frame.py", line 570, in __init__
    arrays, columns = to_arrays(data, columns, dtype=dtype)

  File "C:\Users\XYZ\anaconda3\envs\qgis_env\lib\site-packages\pandas\core\internals\construction.py", line 552, in to_arrays
    return _list_to_arrays(data, columns, coerce_float=coerce_float, dtype=dtype)

  File "C:\Users\XYZ\anaconda3\envs\qgis_env\lib\site-packages\pandas\core\internals\construction.py", line 571, in _list_to_arrays
    raise ValueError(e) from e

ValueError: 3 columns passed, passed data had 4 columns
@biglimp
Copy link
Contributor

biglimp commented Apr 6, 2021

I see you use Anaconda and Spyder. We have experienced version issues and environment setting issues with this before. I personally dont use Anaconda because of this. It looks like you are using Python3.9 and I know QGIS use 3.7. Your specific error seems to be due to conflicts in Pandas version. @sunt05 , do you have any ideas on how to solve this issue?

@sunt05
Copy link
Contributor

sunt05 commented Apr 7, 2021

this is unclear to me how the issue was triggered.
Did the issue happen right after this line:

from processing_umep.processing_umep_provider import ProcessingUMEPProvider

And can you please check your installed supy version?

@nonoq
Copy link
Author

nonoq commented Apr 8, 2021

Thank you for your comments. Based on them I check if supy was installed. It was indeed installed but importing it threw same error. I saw that supy was asking for numpy 1.20 so I downgraded my env to python 3.8.5

This resolved the issue.

Should I close the issue?

@biglimp
Copy link
Contributor

biglimp commented Apr 8, 2021

Thanks for the info. Good to know. Yes lets close this.

@biglimp biglimp closed this as completed Apr 8, 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

3 participants