Open dhill2522 opened 7 months ago
Searching into this a little deeper the class that seems to cause an issue (idaes.core.base.process_block._IndexedActivityCoeffStateBlock
) is not even ever defined in the source code, so the class name itself must be being dynamically generated. An initial search seems to confirm this.
_IndexedActivityCoeffStateBlock
seems to be being used by the BTXParameterBlock
property package. I tried again with a different model that does not use the BTXParameterBlock
property package. This results in the same error, but for a different class:
pyomo.common.errors.DeveloperError: Internal Pyomo implementation error:
"Latex printer encountered an error when processing type <class
'pyomo.core.base.units_container._PyomoUnit'>, contact the
developers"
Please report this to the Pyomo Developers.
It seems that this issue is not limited to a single class at this point.
Summary
When using the
latex_printer
method on an IDAES model an "Internal Pyomo implementation error" is raised. This seems to happen for most any IDAES model. The model solves successfully, so this does not seem to be part of the issue. As far as I can tell this command should print a Latex representation of the IDAES model.It seems this issue may well be related to issue #3048
Steps to reproduce the issue
Properly install Pyomo and IDAES as described in the IDAES documentation(Linux).
Run the following script
m = pyo.ConcreteModel() m.fs = FlowsheetBlock(dynamic=False) m.fs.properties = BTXParameterBlock(valid_phase=('Liq', 'Vap'), activity_coeff_model='Ideal', state_vars='FTPz') m.fs.flash = Flash(property_package=m.fs.properties)
Initialize the system to 0 degrees of freedom
m.fs.flash.inlet.flow_mol.fix(1.0) m.fs.flash.inlet.mole_frac_comp[0, 'benzene'].fix(0.5) m.fs.flash.heat_duty.fix(0) m.fs.flash.inlet.flow_mol.fix(1) m.fs.flash.inlet.temperature.fix(368) m.fs.flash.inlet.pressure.fix(101325) m.fs.flash.inlet.mole_frac_comp[0, "benzene"].fix(0.5) m.fs.flash.inlet.mole_frac_comp[0, "toluene"].fix(0.5) m.fs.flash.heat_duty.fix(0) m.fs.flash.deltaP.fix(0) m.fs.flash.initialize()
solver = pyo.SolverFactory('ipopt') status = solver.solve(m, tee=True)
latex_printer(m)
Traceback (most recent call last): File "/home/dhill25/miniconda3/envs/idaes/lib/python3.10/site-packages/pyomo/contrib/latex_printer/latex_printer.py", line 400, in exitNode return self._operator_handles[node.class](self, node, *data) KeyError: <class 'idaes.core.base.process_block._IndexedActivityCoeffStateBlock'>
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "", line 1, in
File "/home/dhill25/miniconda3/envs/idaes/lib/python3.10/site-packages/pyomo/contrib/latex_printer/latex_printer.py", line 904, in latex_printer
% (visitor.walk_expression(con_template), trailingAligner)
File "/home/dhill25/miniconda3/envs/idaes/lib/python3.10/site-packages/pyomo/core/expr/visitor.py", line 268, in walk_expression
result = self._process_node(root, RECURSION_LIMIT)
File "/home/dhill25/miniconda3/envs/idaes/lib/python3.10/site-packages/pyomo/core/expr/visitor.py", line 351, in _process_node_general
child_result = self._process_node(child, recursion_limit)
File "/home/dhill25/miniconda3/envs/idaes/lib/python3.10/site-packages/pyomo/core/expr/visitor.py", line 351, in _process_node_general
child_result = self._process_node(child, recursion_limit)
File "/home/dhill25/miniconda3/envs/idaes/lib/python3.10/site-packages/pyomo/core/expr/visitor.py", line 351, in _process_node_general
child_result = self._process_node(child, recursion_limit)
[Previous line repeated 3 more times]
File "/home/dhill25/miniconda3/envs/idaes/lib/python3.10/site-packages/pyomo/core/expr/visitor.py", line 371, in _process_node_general
return self.exitNode(node, data)
File "/home/dhill25/miniconda3/envs/idaes/lib/python3.10/site-packages/pyomo/contrib/latex_printer/latex_printer.py", line 402, in exitNode
raise DeveloperError(
pyomo.common.errors.DeveloperError: Internal Pyomo implementation error:
"Latex printer encountered an error when processing type <class
'idaes.core.base.process_block._IndexedActivityCoeffStateBlock'>,
contact the developers"
Please report this to the Pyomo Developers.