NREL / dgen

The Distributed Generation Market Demand (dGen) model simulates customer adoption of distributed energy resources (DERs) for residential, commercial, and industrial entities in the United States and other countries.
BSD 3-Clause "New" or "Revised" License
58 stars 129 forks source link

Model can't find output schema #28

Open HarryTMander opened 1 year ago

HarryTMander commented 1 year ago

Hello,

I am attempting to run the dGen model from Spyder for the first time on my Mac (Monterey 12.5.1), simulating results for California through 2050. However, whenever I run the model I get this error: "relation "diffusion_results_20221117_163243533512_fina.input_main_scenari" does not exist". I included the full console output below.

I am new to Python so this could be a very easy fix that I am overlooking. Any help would be appreciated. Thank you!

ERROR   :   Loading failed with the following error: relation "diffusion_results_20221117_163243533512_fina.input_main_scenari" does not exist
Traceback (most recent call last):
  File "/Users/leliamander/Desktop/Dgen Stuff/dgen/dgen_os/python/settings.py", line 515, in init_scenario_settings
    excel_functions.load_scenario(scenario_settings.input_scenario, scenario_settings.schema, con, cur)
  File "/Users/leliamander/Desktop/Dgen Stuff/dgen/dgen_os/python/decorators.py", line 41, in function_timer
    result = f(*args, **kwargs)
  File "/Users/leliamander/Desktop/Dgen Stuff/dgen/dgen_os/python/excel/excel_functions.py", line 52, in load_scenario
    fnr.to_postgres(con,cur, schema, table)
  File "/Users/leliamander/Desktop/Dgen Stuff/dgen/dgen_os/python/excel/excel_objects.py", line 205, in to_postgres
    cursor.copy_from(s, sql, sep = ',', null = '')
psycopg2.errors.UndefinedTable: relation "diffusion_results_20221117_163243533512_fina.input_main_scenari" does not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/leliamander/Downloads/Dgen Stuff/dgen/dgen_os/python/dgen_model.py", line 75, in main
    scenario_settings = settings.init_scenario_settings(scenario_file, model_settings, con, cur)
  File "/Users/leliamander/Desktop/Dgen Stuff/dgen/dgen_os/python/settings.py", line 517, in init_scenario_settings
    raise Exception('\tLoading failed with the following error: {}'.format(e))
Exception:  Loading failed with the following error: relation "diffusion_results_20221117_163243533512_fina.input_main_scenari" does not exist
mawandembotyini commented 1 year ago

Hi Harry, did you resolve this issue?

michaelavs commented 1 year ago

Hi @mawandembotyini This error comes from an incompatibility with the newer version(s) of Psycopg2. To resolve it, from your terminal with dg3n environment activated, use conda install psycopg2=2.8.6 which will downgrade your version to the last compatible version of Psycopg2. We are working on fixing this bug overall (there is an open PR waiting for review before merging) but this should get you on track until then!

Let me know if that doesn't resolve your issue and I would be happen to look further into your issue!