Fix ModuleNotFoundError: No module named 'httpx' in labs 02 and 05 - #150
Open
ivorb wants to merge 1 commit into
Open
Fix ModuleNotFoundError: No module named 'httpx' in labs 02 and 05#150ivorb wants to merge 1 commit into
ivorb wants to merge 1 commit into
Conversation
azure-ai-projects 2.0.0b4 imports httpx but does not declare it as a dependency; it relied on the openai package pulling httpx in. openai 3.x replaced httpx with httpx2, so fresh installs no longer get httpx and importing azure.ai.projects fails. Pin openai<3 (the version range azure-ai-projects 2.0.0b4 was built against) and declare httpx explicitly in the affected labs. Fixes #147 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Fixes #147
Root cause
azure-ai-projects==2.0.0b4doesimport httpxat the top ofazure/ai/projects/_patch.py(and useshttpx.Client/httpx.HTTPTransportwhen building the OpenAI client), but it does not declarehttpxas a dependency — it relied onopenaipulling it in transitively.azure-ai-projects==2.0.0b4requiresopenai>=2.8.0with no upper bound, andopenai3.x replaced itshttpxdependency withhttpx2. So a freshpip install -r requirements.txtnow resolves openai 3.x,httpxis never installed, andazure.ai.projectsfails withModuleNotFoundError: No module named 'httpx'.Change
Added
openai<3andhttpxto the two Python labs that install and importazure-ai-projects==2.0.0b4:Labfiles/02-language-agent/Python/text-agent/requirements.txtLabfiles/05-speech-tool/Python/speech-client/requirements.txt(same latent failure, not yet reported)The
openai<3pin goes slightly beyond the issue's suggestion of adding onlyhttpx, because the SDK passes anhttpx.Clientinto theOpenAI(...)constructor and readsclient.user_agent. openai 3.x is built onhttpx2, so addinghttpxalone would leave the labs on an untested major version with a mismatched HTTP client type.Labfiles/06-voice-liveinstallsazure-ai-projects==2.0.0b4in its exercise instructions but never imports it, so it is unaffected and left unchanged. No exercise markdown changes are needed — both exercises simply runpip install -r requirements.txt.Verification
Clean venv install of the updated lab 02 requirements: