Pyomo Util Module Not Found
Asked Answered
H

1

2

So I asked a question a month ago. I had a really nice answer to that question. I wanted to test if the answer works right now. But I am getting ModuleNotFoundError.

I did following before testing:

conda install -c conda-forge pyomo
conda install -c conda-forge pyomo.extras 

I want to run this script in my code (copy/pasted from the other question):

from pyomo.util.infeasible import log_infeasible_constraints
...
SolverFactory('your_solver').solve(model)
...
log_infeasible_constraints(model)

Error I encounter:

N:\urbs>python runme.py
Traceback (most recent call last):
  File "runme.py", line 9, in <module>
    from pyomo.util.infeasible import log_infeasible_constraints
ModuleNotFoundError: No module named 'pyomo.util.infeasible'

How to install it then? I checked doc etc..., could not find a way.

Habitforming answered 23/8, 2018 at 12:5 Comment(0)
W
3

Pyomo 5.5 (the latest released version as of 23 August 2018) does not yet have that feature. I had mistakenly assumed that it was included. You can either change your version of pyomo to track master, or more easily, you can simply take the function at https://github.com/Pyomo/pyomo/blob/master/pyomo/util/infeasible.py and place it in your own code (along with the associated required imports).

Weekender answered 23/8, 2018 at 15:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.