Skip to main content

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.
You can check your Python version with:

Installation options

FastAPI offers two installation options depending on your needs:
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:
With the minimal installation, you’ll need to install additional dependencies manually based on your needs:

What’s included in the standard installation?

When you install fastapi[standard], you get: Used by Pydantic:
  • email-validator - Email validation support
  • pydantic-settings - Settings management
  • pydantic-extra-types - Extra data types
Used by Starlette:
  • httpx - HTTP client for testing with TestClient
  • jinja2 - Template rendering support
  • python-multipart - Form parsing and file uploads
Used by FastAPI:
  • uvicorn[standard] - ASGI server for running your application
  • fastapi-cli[standard] - Command-line interface with the fastapi command
The fastapi[standard] installation includes fastapi-cloud-cli for deploying to FastAPI Cloud. If you don’t want this, use pip install "fastapi[standard-no-fastapi-cloud-cli]" instead.

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