Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError no module name 'httpx' #143

Open
VianneyMI opened this issue Feb 14, 2025 · 1 comment
Open

ModuleNotFoundError no module name 'httpx' #143

VianneyMI opened this issue Feb 14, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@VianneyMI
Copy link

Describe the bug
A clear and concise description of what the bug is.

Following the client tutorial, I am trying to launch the client with the weather server previously developed and I get this ModuleNotFoundError : No module name 'httpx'

Is it because I created separated virtual environments for the clients and the servers ?

Anyway, I have httpx installed in both.

How does the client process the provided server ? Do I need to launch the server manually first ?

Below is my project structure

model_context_protocol/

┣ mcp_client/
┃ ┣ .venv/
┃ ┣ .env
┃ ┣ .gitignore
┃ ┣ .python-version
┃ ┣ client.py
┃ ┣ pyproject.toml
┃ ┣ README.md
┃ ┗ uv.lock
┗ weather/
  ┣ .venv/
  ┣ .python-version
  ┣ pyproject.toml
  ┣ README.md
  ┣ uv.lock
  ┗ weather.py
@VianneyMI VianneyMI added the bug Something isn't working label Feb 14, 2025
@SHTechBoBo
Copy link

Oh, I know. There's one line in client.py: command = "python" if is_python else "node".
The logic behind it is to execute this command with anyio.open_process, if you just use python, then it will use the system's default python interpreter, not the virtual environment you created.
The true code is: command = "<YOUR_VENV_PATH>\\.venv\\Scripts\\python.exe" if is_python else "node".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants