Repository navigation
Raise an actionable error when onnxruntime is not installed - #2736
Merged
Xiaoyu Z (xiaoyu-work) merged 5 commits intoNov 5, 2026
Merged
Xiaoyu Z (xiaoyu-work) merged 5 commits into
Xiaoyu Z (xiaoyu-work) merged 5 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.
Contributor
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
5 tasks
Per review: the error now just says that onnxruntime is not installed, and the tests added for it are removed.
Xiaoyu Z (xiaoyu-work)
approved these changes
Nov 4, 2026
Xiaoyu Z (xiaoyu-work)
approved these changes
Nov 4, 2026
Member
|
can you update branch to merge main? |
Contributor
Author
|
Done, merged the latest |
Xiaoyu Z (xiaoyu-work)
enabled auto-merge (squash)
November 5, 2026 21:27
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
onnxruntime is not an Olive dependency, so installing only
olive-aiand running a workflow (for exampleolive auto-opt ... --device cpu) used to fail inget_ort_available_providerswith a bareModuleNotFoundError: No module named 'onnxruntime'.get_ort_available_providersnow raisesImportError("onnxruntime is not installed.")in that case, chained to the original error. Other import failures, such as a missing dependency of an installed onnxruntime, are re-raised unchanged.Checklist before requesting a review
lintrunner -aRunning Olive without onnxruntime installed now reports that onnxruntime is not installed.
(Optional) Issue link
Fixes #2284