Installation
Get started with FastAPI by installing it in your Python environment.Requirements
FastAPI requires Python 3.10 or higher. Make sure you have a compatible Python version installed.
Installation options
FastAPI offers two installation options depending on your needs:Standard installation (recommended)
1
Create a virtual environment
It’s recommended to create a virtual environment for your project:Activate the virtual environment:
2
Install FastAPI with standard dependencies
Install FastAPI with all standard dependencies included:
Make sure to use quotes around
"fastapi[standard]" to ensure it works correctly in all terminals.3
Verify installation
Verify that FastAPI is installed correctly:
Minimal installation
If you want more control over dependencies, you can install just the core FastAPI package:What’s included in the standard installation?
When you installfastapi[standard], you get:
Used by Pydantic:
email-validator- Email validation supportpydantic-settings- Settings managementpydantic-extra-types- Extra data types
httpx- HTTP client for testing withTestClientjinja2- Template rendering supportpython-multipart- Form parsing and file uploads
uvicorn[standard]- ASGI server for running your applicationfastapi-cli[standard]- Command-line interface with thefastapicommand
Understanding the dependencies
Core dependencies
FastAPI has only a few core dependencies that are always installed:- Starlette (≥0.46.0) - Web framework foundation
- Pydantic (≥2.7.0) - Data validation using Python type hints
- typing-extensions (≥4.8.0) - Backported type hints
- typing-inspection (≥0.4.2) - Runtime type inspection
- annotated-doc (≥0.0.2) - Documentation annotations
Optional dependencies
You can install additional packages for specific features:Next steps
Now that you have FastAPI installed, you’re ready to build your first API:Quick start guide
Create your first FastAPI application in minutes