error with running the model

286 views
Skip to first unread message

giulia pezzin

unread,
Jun 9, 2021, 11:04:21 PM6/9/21
to Temoa Project
Hi everyone,

I'm trying to run the model but it gives me this error: 

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/giuliapezzin/documenti2/temoa-energysystem/temoa_model/__main__.py", line 30, in <module>
    runModel()
  File "/Users/giuliapezzin/documenti2/temoa-energysystem/temoa_model/temoa_model.py", line 543, in runModel
    solver = TemoaSolver(model, dummy)
  File "/Users/giuliapezzin/documenti2/temoa-energysystem/temoa_model/temoa_run.py", line 85, in __init__
    self.temoa_setup()
  File "/Users/giuliapezzin/documenti2/temoa-energysystem/temoa_model/temoa_run.py", line 102, in temoa_setup
    self.options, config_flag = parse_args()
  File "/Users/giuliapezzin/documenti2/temoa-energysystem/temoa_model/temoa_run.py", line 500, in parse_args
    available_solvers, default_solver = get_solvers()
  File "/Users/giuliapezzin/documenti2/temoa-energysystem/temoa_model/temoa_run.py", line 452, in get_solvers
    services = SF.services() # pyutilib version <= 5.6.3
AttributeError: 'SolverFactoryClass' object has no attribute 'services'

Since now the errors I had were related to some missing packages so I solved them by installing what was needed. But this one seems different and I'm not finding any solution online.

Thank you in advance. 

Joe

unread,
Jun 10, 2021, 10:13:48 AM6/10/21
to Temoa Project
Did you install the Temoa environment using the environment file, as explained here? If not, you my be running into version issues with some of the required software elements.

Best,
Joe

giulia pezzin

unread,
Jun 13, 2021, 11:54:09 AM6/13/21
to Temoa Project
Thank you for your kind answer. 

Yes I've already had the environment file on my Mac. I've tried anyway to remove and create again the conda environment following the steps in the video but it gave me the same error.
I tried to install an older version of pyutilib and now the error has changed (see below), but I'm truly going with guesses right now so I'm not sure if I have made improvements or instead worsened the situation. 

(temoa-py3) (venv) Air-di-Giulia:temoa-energysystem giuliapezzin$ python temoa_model/ --config=temoa_model/config_sample
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/giuliapezzin/documenti2/temoa-energysystem/temoa_model/__main__.py", line 28, in <module>
    from temoa_model import *
  File "/Users/giuliapezzin/documenti2/temoa-energysystem/temoa_model/temoa_model.py", line 26, in <module>
    from temoa_run import *
  File "/Users/giuliapezzin/documenti2/temoa-energysystem/temoa_model/temoa_run.py", line 29, in <module>
    from pyomo.environ import *
  File "/Users/giuliapezzin/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/pyomo/environ/__init__.py", line 103, in <module>
    _import_packages()
  File "/Users/giuliapezzin/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/pyomo/environ/__init__.py", line 89, in _import_packages
    pkg.load()
  File "/Users/giuliapezzin/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/pyomo/dataportal/plugins/__init__.py", line 21, in load
    import pyomo.dataportal.plugins.sheet
  File "/Users/giuliapezzin/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/pyomo/dataportal/plugins/sheet.py", line 21, in <module>
    from pyutilib.excel.spreadsheet import ExcelSpreadsheet, Interfaces
ImportError: cannot import name 'Interfaces' from 'pyutilib.excel.spreadsheet' (/Users/giuliapezzin/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/pyutilib/excel/spreadsheet.py)
 
Thank you again for your time. 

Giulia Pezzin

Joe

unread,
Jun 13, 2021, 12:03:53 PM6/13/21
to Temoa Project
Hi Giulia,

Unfortunately, I'm not sure what the issue may be. Looking at the stack trace, are you trying to import data from a spreadsheet? What happens when you simply run:

$ pyomo solve --help

If it works, what happens when you run the following from the temoa directory:

$ pyomo solve --solver=<solver> temoa_model/temoa_model.py data_files/utopia-15.py

Let me know the output from these commands, and we can take it from there. If the first command doesn't work, you may need to ask on the pyomo forum.

Best,
Joe

giulia pezzin

unread,
Jul 22, 2021, 1:23:56 PM7/22/21
to Temoa Project
Thank you very much for all the help.
I've tried to contact the pyomo forum since the first command does not work and it seems then to be a problem related to that package. 

Thank you again  and have a good day. 

Best regards, 
Giulia

Daniele Mosso

unread,
Jan 14, 2022, 8:20:40 AM1/14/22
to Temoa Project
Giulia, finally how did you solved? I'm getting the same problem after updating pyomo from 5.5 to 6.2

Temoa Project

unread,
Jan 18, 2022, 3:03:30 PM1/18/22
to Temoa Project
Hi Daniele,

Temoa currently only runs on Pyomo version 5.5, as noted in the environment file. See Joe's earlier email in this thread about installing the Temoa environment using the environment.yml file. 
I hope this helps. 

Best,
Aranya

Samuel Dotson

unread,
Feb 2, 2022, 8:45:23 PM2/2/22
to Temoa Project
Hello all, 

I'm checking in on this post since I am experiencing issues running a model on a Windows 10 machine.

1) Temoa doesn't seem to accept glpk as a solver when CPLEX is available on my machine (i.e. --solver=glpk does not work)
2) When using Pyomo 5.5 and CPLEX (version 20.1) I get the following error:
objective_value = (tokens[0].split('=')[1].strip()).lstrip("\"").rstrip("\"")
IndexError: list index out of range
3) This post from early last year suggests updating Pyomo solves the issue. Yet, as Daniele and Aranya found, doing so introduces a new issue.

Any guidance in this matter is appreciated. 

Thanks, 
Sam 

Temoa Project

unread,
Feb 3, 2022, 8:54:19 PM2/3/22
to Temoa Project
Hi Sam,

Could you check what version of glpk you have currently installed ("conda list")?
We just tested temoa_utopia on a Windows machine with glpk (version 4.65) that was installed using the temoa environment.yml file and that seemed to work. 

Best,
Aranya
Reply all
Reply to author
Forward
0 new messages