Repository navigation
Python: provide actionable install-extra errors for missing connector dependencies (#14328) - #14659
Open
Hardik K (hardikkaurani) wants to merge 1 commit into
Conversation
Hardik K (hardikkaurani)
deployed
to
github-app-auth
October 24, 2026 13:34 — with
GitHub Actions
Active
Contributor
Author
|
Hi Eduard van Valkenburg (@eavanvalkenburg), Could you please take a look at this pull request when you have a moment? It addresses #14328 by adding actionable install-extra error messages for optional connector dependencies ( All Ruff checks and unit tests are passing cleanly. Thank you! |
This branch was successfully 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.
Motivation and Context
Closes #14328
When optional connector dependencies (such as
transformers,torch,onnxruntime-genai, orchromadb) are not installed in the environment, callers could encounter abrupt module-level import errors or genericModuleNotFoundError/ImportErrorexceptions that did not clarify which Semantic Kernel extra needed to be installed.Specifically:
hf_prompt_execution_settings.pyattempted to loadtransformersunconditionally at the module level withouttry...except, crashing upon import when optional Hugging Face extras were omitted. Additionally,get_generation_config()importedGenerationConfigbefore verifying the optional dependency status.hf_text_completion.pyandhf_text_embedding.pyeagerly importedtorchandtransformersat the top level, preventing callers from importing or handling Hugging Face settings or services gracefully without pre-installed packages.OnnxGenAICompletionBaseandChromaMemoryStoreraised generic error messages that did not identify the specific Semantic Kernel install extra (semantic-kernel[onnx]andsemantic-kernel[chroma]).Description
transformersandtorchimports inhf_prompt_execution_settings.py,hf_text_completion.py, andhf_text_embedding.pywithtry...except (ImportError, ModuleNotFoundError).semantic-kernel[hugging_face]when attempting to instantiate uninstalled services or invokeget_generation_config().OnnxGenAICompletionBaselazy-import error message to specifypip install semantic-kernel[onnx]._generate_next_token.ChromaMemoryStoreto explicitly referencepip install semantic-kernel[chroma].tests/unit/connectors/test_optional_dependencies.pycovering:HuggingFacePromptExecutionSettingsboth with and withouttransformers.HuggingFaceTextCompletionandHuggingFaceTextEmbeddingwithout required extras.OnnxGenAICompletionBasewithoutonnxruntime-genai.ChromaMemoryStorewithoutchromadb.Contribution Checklist