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 named 'uvicorn' #74

Open
nicosuave opened this issue Dec 23, 2024 · 3 comments
Open

ModuleNotFoundError: No module named 'uvicorn' #74

nicosuave opened this issue Dec 23, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@nicosuave
Copy link

I'm needing to manually add uvicorn to my package to run in dev mode.

Then when installed in Claude desktop I just see the following in Claude logs

ModuleNotFoundError: No module named 'uvicorn' in claude logs stemming from site-packages/fastmcp/server.py

@github-actions github-actions bot added the bug Something isn't working label Dec 23, 2024
@marcusmotill
Copy link

I am not a uv god so def a little confused on how this bundling works but I was able to overcome this error my using the --with flag:
uv run fastmcp install --with uvicorn server.py

@paquino11
Copy link

paquino11 commented Dec 31, 2024

Got the same issue while following the quickstart, by running the following command worked for me
uv run fastmcp install --with uvicorn server.py
uv run fastmcp dev --with uvicorn server.py

@boukeversteegh
Copy link

This problem doesn't only affect uvicorn, but possibly all projects dependencies, because -- if i understand correctly -- the way the fastmcp install works now, is that it doesn't run from the project directory, so all your pyproject.toml dependencies are ignored.

I was able to fix this by editing the generated mcp settings file as follows:

    "My MCP Server": {
      "command": "uv",
      "args": [
        "run",
-       "--with"
-       "uvicorn"
-       "--with"
-       "another-dependency"
+       "--project",
+       "C:\\my-mcp-server-project",
        "fastmcp",
        "run",
        "C:\\my-mcp-server-project\\server.py"
      ]
    }

To avoid the uvicorn depedency problem, you need to run uv add uvicorn within your project once. This will install it in the toml file, and it will be picked up the above command.

jurasofish added a commit to jurasofish/mcpunk that referenced this issue Jan 2, 2025
@nicosuave nicosuave reopened this Jan 3, 2025
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

4 participants