FastAPI "uvicorn: command not found" in CI
The shell could not find a uvicorn executable. Either uvicorn was never installed into the active interpreter, or it lives in a venv the step did not activate, so its console script is not on PATH.
What this error means
A step that runs uvicorn app.main:app fails with "uvicorn: command not found" and exit code 127, even though python --version works.
python
/home/runner/work/_temp/script.sh: line 1: uvicorn: command not found
Error: Process completed with exit code 127.Common causes
uvicorn is not a declared dependency
The install step brought in FastAPI but not uvicorn, so no uvicorn script exists on the runner.
A venv holding uvicorn was not activated
uvicorn is installed inside a virtual environment that the current step did not activate, so the launcher is not on PATH.
How to fix it
Install uvicorn and run it as a module
Add uvicorn to your dependencies and invoke it through the interpreter so PATH is never the issue.
Terminal
python -m pip install "uvicorn[standard]"
python -m uvicorn app.main:app --host 0.0.0.0 --port 8000Activate the venv that holds uvicorn
- Confirm uvicorn is installed with
python -m pip show uvicorn. - Activate the venv in the same step before calling uvicorn.
- Prefer
python -m uvicornover the bare console script.
Terminal
. .venv/bin/activate
python -m uvicorn app.main:appHow to prevent it
- Declare
uvicorn[standard]in your requirements or pyproject dependencies. - Call
python -m uvicornso PATH lookup never fails. - Activate the correct venv in every step that launches the server.
Related guides
FastAPI "ModuleNotFoundError: No module named 'app'" in CIFix FastAPI "ModuleNotFoundError: No module named 'app'" in CI - pytest or uvicorn cannot import your applica…
FastAPI "Address already in use" from uvicorn in CIFix uvicorn "[Errno 98] address already in use" in CI - an integration test started the server on a port that…
FastAPI gunicorn "Invalid value for --worker-class" (uvicorn worker) in CIFix gunicorn "Invalid value for worker_class" / "class uri ... invalid" in CI - the uvicorn worker class is r…