iiasa / message_ix

The integrated assessment and energy systems model MESSAGEix
https://docs.messageix.org
Apache License 2.0
119 stars 153 forks source link

Scenario.solve(...) works in Python but GAMS errors in R #257

Open guofei2016 opened 4 years ago

guofei2016 commented 4 years ago

I recently tried to install the new version of MESSAGEix with R use, but found the function "solve" do not completely work in R for the new version of model. In comparison, the "solve" function did worked in Python.

I even tried to give the specific paths to the three arguments, "model_file", "in_file", and "out_file" as below, and it could only generate the Data.gdx file in the right directory but not the Output.gdx file. The GAMS error message is No. 3 "There was an execution error".

ixScenario$solve(model = "MESSAGE", case = newscenarioName, model_file = paste0(getwd(), '/MESSAGE_run.gms'), in_file = paste0(getwd(), '/data/MsgData_test2.gdx'), out_file = paste0(getwd(), '/output/MsgOutput_test2.gdx'))

khaeru commented 4 years ago

@guofei2016 thank you for opening this issue!

In order to help someone else reproduce and fix it, can you provide a minimal R script that triggers this error? Please also mention which database you are connecting to (but don't paste the username/password in this public issue!).

volker-krey commented 4 years ago

As part of teaching at NTNU during the week of October 21st, I also tried the reticulate-based Austria tutorial (https://github.com/iiasa/message_ix/blob/master/tutorial/Austrian_energy_system/austria_reticulate.ipynb) which worked without problems for me, including the solve statement. @guofei2016 I suggest you try to run that tutorial on your computer to see whether this reproduces the same mistake that your script produces.

khaeru commented 4 years ago

@adrivinca this is the one we mentioned in yesterday's meeting. Would you mind to have a look/follow-up with Fei?