Closed gschivley closed 5 years ago
It looks like the function get_solvers
is trying to determine the available solvers. Not sure what version of pyomo (or related packages) this works on but I ended up looping through a list of common solvers.
for sname in ['glpk', 'cplex', 'gurobi', 'cbc']: #SF.services(): # list of solver interface names
Obviously it's nicer to automatically find solvers but this works for now.
SolverFactory.services() is deprecated in newer versions of Pyomo. It has been replaced by the iter() method on the SolverFactory class. If the following change is made then the issue is resolved.
for sname in SF.services():
needs to become for sname in SF:
Hi Lucas -- Thanks for the tip. I tried with for sname in SF
as you suggested, but get the following error:
File "temoa_model/temoa_run.py", line 421, in get_solvers for sname in SF: TypeError: 'new' object is not iterable
Any thoughts?
SolverFactoryClass
inherits the Factory
class from pyutilib
. This is where __iter__()
is defined. I have no issues with for sname in SF:
in python2 or python3. It could be that the pyutilib
package is not current.
I currently am running:
pyomo
version 5.6.6 (this is the only difference between the environment.yml
where pyomo is required to be 5.5.
pyutilib
version 5.7.1
python
version 2.7.16 and 3.7.3
I was able to recreate the issue described by TemoaProject by using pyutilib version 5.6.3
. However, I was was able to use SolverFactory.services()
to perform the same action using this environment.
In pyutilib
versions up to 5.6.3, the SF.services()
should work. Beginning in pyutilib
version 5.6.4, the Factory
class is created and .services()
is deprecated and its functionality replaced with the __iter__()
method. So using the most current pyutilib
package (5.7.1) will allow for sname in SF:
.
Thanks @lcford2 for helping to resolve this issue.
When trying to run the basic help command I ran into the error below. In this environment I'm running python 2.7 and pyomo 5.6.1.