Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maraboupy imports parsers only when required packages are installed #257

Merged
merged 4 commits into from
May 7, 2020

Conversation

kjulian3
Copy link
Collaborator

@kjulian3 kjulian3 commented May 3, 2020

This pr addresses #256. By catching ImportErrors when importing the tensorflow and onnx parsers, we can prevent errors caused by tensorflow or onnx/onnxruntime not being installed. This allows tensorflow users to use maraboupy without ever needing to install or worry about onnx/onnxruntime. They'd be able to use Marabou.read_tf(), but would get an error if they tried to run Marabou.read_onnx().

Users do get a warning when they import Marabou but don't have tensorflow or onnx/onnxruntime installed. The warning will let people that they need to install some packages if they want to use that input parser. However, they will still be able to use Maraboupy's other parsers without error.

@kjulian3 kjulian3 requested review from clazarus and wu-haoze and removed request for clazarus May 3, 2020 01:57
@wu-haoze wu-haoze self-assigned this May 7, 2020
Copy link
Collaborator

@wu-haoze wu-haoze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works on my machine. LTGM.

@kjulian3 kjulian3 merged commit d165cdc into NeuralNetworkVerification:master May 7, 2020
@kjulian3 kjulian3 deleted the py_imports branch May 7, 2020 20:05
AleksandarZeljic pushed a commit to AleksandarZeljic/Marabou that referenced this pull request Oct 9, 2020
…euralNetworkVerification#257)

* Try importing parsers

* Give warnings

Co-authored-by: Guy Katz <guyk@cs.stanford.edu>
Co-authored-by: Kyle Julian <kjulian3.stanford.edu>
matanost pushed a commit that referenced this pull request Nov 2, 2021
…257)

* Try importing parsers

* Give warnings

Co-authored-by: Guy Katz <guyk@cs.stanford.edu>
Co-authored-by: Kyle Julian <kjulian3.stanford.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants