architecture-building-systems / CityEnergyAnalyst

The City Energy Analyst (CEA)
https://www.cityenergyanalyst.com/
MIT License
196 stars 66 forks source link

Fail to run "radiation-simplified" #3383

Closed pengxiang-liu closed 1 year ago

pengxiang-liu commented 1 year ago

Describe the bug Fail to run script "radiation-simpfied".

Error Message Traceback (most recent call last): File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\cea\worker.py", line 146, in worker run_job(config, job, server) File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\cea\worker.py", line 108, in run_job script(config=config, *parameters) File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\cea\api.py", line 60, in call self._runner.call(args, **kwargs) File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\cea\api.py", line 65, in getattribute self._runner = script_wrapper(self._cea_script) File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\cea\api.py", line 16, in script_wrapper script_module = importlib.import_module(module_path) File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 961, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'cea.resources.radiation.simplified'

To Reproduce Run "cea --help radiation-simplified" in the CEA console.

Hardware (please complete the following information):

ShiZhongming commented 1 year ago

@TesLarry I just tested cea radiation-simplified and it ran through. Hence, I could not reproduce your error. Are you using the developer's version? The module for radiation-simplified is supposed to be 'cea.resources.radiation.simplified.main'. Did you change it accidentally?

pengxiang-liu commented 1 year ago

@shizhongming Hi Zhongming, thank you for your reply. I received the same error message on two different computers (one with the developer version installed and the other without). I am trying a clean install on a virtual machine to see whether this bug can be reproduced.

pengxiang-liu commented 1 year ago

@shizhongming Hi Zhongming, the error was reproduced. Here are the steps:

  1. Create a virtual machine in VMWare Workstation (version: Windows 11 Pro 22H2)
  2. Install CEA v3.34.1 (https://github.com/architecture-building-systems/CityEnergyAnalyst/releases/download/v.3.34.1/Setup_CityEnergyAnalyst_3.34.1.exe) with default settings.
  3. Open CEA Console
  4. Run the command "CEA --help radiation-simplified"
ShiZhongming commented 1 year ago

@TesLarry I just tested it using another computer, and it worked fine again. Did you send us the full error message? Did you miss one paragraph on the top?

ShiZhongming commented 1 year ago

Also, about the command on CEA Console, it is supposed to be cea radiation-simplified.

pengxiang-liu commented 1 year ago

@shizhongming

Actually, cea radiation-simplified fails, too. I also tried to run this command in CEA dashboard. Here is the screenshot

screenshot

Full error message:

Traceback (most recent call last):
  File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\cea\worker.py", line 146, in worker
    run_job(config, job, server)
  File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\cea\worker.py", line 108, in run_job
    script(config=config, **parameters)
  File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\cea\api.py", line 60, in __call__
    self._runner.__call__(*args, **kwargs)
  File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\cea\api.py", line 65, in __getattribute__
    self._runner = script_wrapper(self._cea_script)
  File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\cea\api.py", line 16, in script_wrapper
    script_module = importlib.import_module(module_path)
  File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'cea.resources.radiation.simplified'

About the command: The error is similar to the one returned by cea --help radiation-simplified, so I believe it is the easiest way to reproduce the bug. In addition, cea radiation works perfectly on my computer.

ShiZhongming commented 1 year ago

@TesLarry Still, we can't reproduce your error here..

Can you use the computer with the developer's version? Then, go to the source code: CityEnergyAnalyst>cea>scripts.yml Then, go to the paragraph starting with: -name:radiation-simplified Then, check if the module is cea.resources.radiation.simplified.main

pengxiang-liu commented 1 year ago

@shizhongming The developer's version works after reinstallation, while the stable version does not (even after reinstallation).

As to the stable version, I checked the code in CityEnergyAnalyst\Dependencies\Python\Lib\site-packages\cea\scripts.yml. The module for -name:radiation-simplified is cea.resources.radiation.simplified.main.

In addition, I found a new problem during the use. The command cea emissions fails in both the stable and developer's versions if its embodied parameter is set to True. Here is the error message:

City Energy Analyst version 3.34.1
Running `cea emissions` with the following parameters:
- general:scenario = D:\GitHub\PhD-programme\meta\city_energy_analyst\demo\nanjing\southeast_university
  (default: {general:project}\{general:scenario-name})
- emissions:year-to-calculate = 2023
  (default: 2023)
- emissions:embodied = True
  (default: True)
- emissions:operation = True
  (default: True)
Traceback (most recent call last):
  File "c:\users\pxliu\documents\cityenergyanalyst\cityenergyanalyst\cea\worker.py", line 146, in worker
    run_job(config, job, server)
  File "c:\users\pxliu\documents\cityenergyanalyst\cityenergyanalyst\cea\worker.py", line 108, in run_job
    script(config=config, **parameters)
  File "c:\users\pxliu\documents\cityenergyanalyst\cityenergyanalyst\cea\api.py", line 60, in __call__
    self._runner.__call__(*args, **kwargs)
  File "c:\users\pxliu\documents\cityenergyanalyst\cityenergyanalyst\cea\api.py", line 38, in script_runner
    script_module.main(config)
  File "c:\users\pxliu\documents\cityenergyanalyst\cityenergyanalyst\cea\analysis\lca\main.py", line 50, in main
    emissions_main(locator=locator, config=config)
  File "c:\users\pxliu\documents\cityenergyanalyst\cityenergyanalyst\cea\analysis\lca\main.py", line 37, in emissions_main
    lca_embodied(year_to_calculate, locator)
  File "c:\users\pxliu\documents\cityenergyanalyst\cityenergyanalyst\cea\analysis\lca\embodied.py", line 140, in lca_embodied
    surface_properties = df[fields].merge(df2[fields2],
  File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\pandas\core\frame.py", line 3813, in __getitem__
    indexer = self.columns._get_indexer_strict(key, "columns")[1]
  File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\pandas\core\indexes\base.py", line 6070, in _get_indexer_strict
    self._raise_if_missing(keyarr, indexer, axis_name)
  File "C:\Users\pxliu\Documents\CityEnergyAnalyst\Dependencies\Python\lib\site-packages\pandas\core\indexes\base.py", line 6133, in _raise_if_missing
    raise KeyError(f"{not_found} not in index")
KeyError: "['GHG_win_kgCO2m2'] not in index"

Running emissions with scenario = D:\GitHub\PhD-programme\meta\city_energy_analyst\demo\nanjing\southeast_university
ShiZhongming commented 1 year ago

@reyery Will you know what's going on with the installation?

@TesLarry About cea emissions, I can't reproduce this error either and I suspect it might be the installation causing this, as we have just updated the database for emissions. Can you go to: cea>databases>ch(or sg)>assemblies>envelope.xlsx Check if Column GHG_win_kgCO2m2 under Tab WINDOW exist?

pengxiang-liu commented 1 year ago

@shizhongming About cea emissions, you are right. I am using a customized database created by CEA V3.32. After I update it based on the latest version, the command cea emissions works. I think that's it. The problem is solved. Thank you very much.

ShiZhongming commented 1 year ago

@TesLarry Happy it worked!