Skip to content

Commit

Permalink
Pretty print error message when onnx wheel not available (#359)
Browse files Browse the repository at this point in the history
In the case where a user is using python 3.10 and has requested to
build with ``smart build --onnx`` there is no compliant onnx wheel
for python 3.10 for the ORT backend installed by default for RAI. This
was leading to a SetupError being raised, and eventually exposing
itself to the user.

This will handle that raised exception and pretty print the error
message before exiting with a non-zero exit code.

[ committed by @MattToast ]
[ reviewed by @al-rigazzi ]
  • Loading branch information
MattToast authored Sep 11, 2023
1 parent b459bf2 commit 74abcc3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions smartsim/_core/_cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,16 @@ def execute(args: argparse.Namespace) -> int:
backends_str = ", ".join(s.capitalize() for s in backends) if backends else "No"
logger.info(f"{backends_str} backend(s) built")

if "torch" in backends:
check_py_torch_version(versions, device)
if "tensorflow" in backends:
check_py_tf_version(versions)
if "onnxruntime" in backends:
check_py_onnx_version(versions)
try:
if "torch" in backends:
check_py_torch_version(versions, device)
if "tensorflow" in backends:
check_py_tf_version(versions)
if "onnxruntime" in backends:
check_py_onnx_version(versions)
except SetupError as e:
logger.error(str(e))
return 1

logger.info("SmartSim build complete!")
return 0
Expand Down

0 comments on commit 74abcc3

Please sign in to comment.