Repository navigation
Raise an actionable error when onnxruntime is not installed - #2736
Open
Oke Iyanuoluwa Enoch (Iyanuoluwa007) wants to merge 3 commits into
Open
Oke Iyanuoluwa Enoch (Iyanuoluwa007) wants to merge 3 commits into
Oke Iyanuoluwa Enoch (Iyanuoluwa007) wants to merge 3 commits into
Conversation
Running a workflow after installing only the base olive-ai package failed with a bare "ModuleNotFoundError: No module named 'onnxruntime'" from get_ort_available_providers. Explain that an ONNX Runtime package is needed and which olive-ai extra installs it. Fixes microsoft#2284
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The broad exception handler mislabels native-library and dependency failures as a missing ONNX Runtime installation.
1 open finding
What changed in this PR
Improves Olive’s missing-ONNX-Runtime error with installation guidance, addressing the workflow failure reported in #2284.
Changes:
- Adds device-specific installation instructions and chains the original exception.
- Adds regression coverage for a missing ONNX Runtime package.
| File | Description |
|---|---|
| test/common/test_ort_inference.py | Tests the actionable missing-package error. |
| olive/common/ort_inference.py | Adds installation guidance to import failures. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Author
|
@microsoft-github-policy-service agree |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Oke Iyanuoluwa Enoch (Iyanuoluwa007)
requested a balanced review from Copilot
October 16, 2026 19:40
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Describe your changes
Installing only the base
olive-aipackage and running a workflow (for exampleolive auto-opt ... --device cpu) fails inget_ort_available_providerswith a bareModuleNotFoundError: No module named 'onnxruntime', which does not tell the user what to install.get_ort_available_providersnow catches the import failure and raises anImportErrorthat explains an ONNX Runtime package is required and names the matching extras (olive-ai[cpu],olive-ai[gpu],olive-ai[directml]). The original exception is chained.Checklist before requesting a review
pytest test/common/test_ort_inference.py: 9 passed)lintrunner -a(ruff 0.15.11 check and format on changed files)Running Olive without onnxruntime installed now reports which package or extra to install.
(Optional) Issue link
Fixes #2284