You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that there is a missing required dependency in the OMLT 1.0 release: onnx is listed as a "testing" dependency, but is required in order to import anything from omlt.io.
% python
Python 3.7.12 (default, Nov 10 2021, 15:38:43)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from omlt.io.keras_reader import load_keras_sequential
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "[...]/site-packages/omlt/io/__init__.py", line 1, in <module>
from omlt.io.onnx import load_onnx_neural_network, write_onnx_model_with_bounds, load_onnx_neural_network_with_bounds
File "[...]/site-packages/omlt/io/onnx.py", line 4, in <module>
import onnx
ModuleNotFoundError: No module named 'onnx'
Possible solutions:
Don't import anything from omlt/io/__init__.py
Leverage a delayed import mechanism in omlt/io/onnx.py (e.g., something like pyomo.common.dependencies.attempt_import())
Add onnx as a required dependency
The text was updated successfully, but these errors were encountered:
I see, even if you have tensorflow installed, it will hit the onnx code when you try to use the keras reader.
I think I'm in favor of either/both of the first two suggestions. Maybe we shouldn't be importing anything in omlt/io/__init__.py and also attempt what Pyomo does.
I remember talking with @carldlaird about this. We'll come up with something to clean this up.
I believe that there is a missing required dependency in the OMLT 1.0 release:
onnx
is listed as a "testing" dependency, but is required in order to import anything fromomlt.io
.Steps to reproduce:
Possible solutions:
omlt/io/__init__.py
omlt/io/onnx.py
(e.g., something likepyomo.common.dependencies.attempt_import()
)onnx
as a required dependencyThe text was updated successfully, but these errors were encountered: