Skip to main content
Flask is a lightweight WSGI web application framework for Python. This guide will help you install Flask and get your development environment ready.

Python Version Requirements

Flask requires Python 3.10 or newer. You can check your Python version with:
python --version
# or
python3 --version
Flask 3.2.0 requires Python 3.10+. If you need to support older Python versions, consider using an earlier Flask release.

Virtual Environments

It’s strongly recommended to use a virtual environment to manage your project dependencies and avoid conflicts with system-wide packages.
1

Create a project directory

mkdir myproject
cd myproject
2

Create a virtual environment

python3 -m venv .venv
3

Activate the virtual environment

. .venv/bin/activate
Your shell prompt will change to show the name of the activated environment.

Install Flask

Once your virtual environment is activated, install Flask using pip:
pip install Flask
This will install Flask along with its core dependencies:
  • Werkzeug (≥3.1.0) - WSGI utilities library
  • Jinja2 (≥3.1.2) - Template engine
  • Click (≥8.1.3) - Command-line interface framework
  • ItsDangerous (≥2.2.0) - Data signing library
  • Blinker (≥1.9.0) - Signal support
  • MarkupSafe (≥2.1.1) - String escaping

Optional Dependencies

Flask provides optional features that require additional dependencies:

Async Support

For asynchronous view functions and routes:
pip install Flask[async]
This installs asgiref for async support.

Environment Variables from .env Files

To automatically load environment variables from .env files:
pip install Flask[dotenv]
This installs python-dotenv.

Install All Optional Dependencies

pip install Flask[async,dotenv]

Verify Installation

Verify that Flask is installed correctly:
python -c "import flask; print(flask.__version__)"
You can also use the Flask CLI:
flask --version
This will display:
  • Python version
  • Flask version
  • Werkzeug version

Development Installation

If you want to contribute to Flask or install from source:
1

Clone the repository

git clone https://github.com/pallets/flask
cd flask
2

Create and activate a virtual environment

python3 -m venv .venv
. .venv/bin/activate
3

Install in editable mode

pip install -e .
This installs Flask in editable mode, so changes to the source code are immediately available.

Next Steps

Quickstart

Build your first Flask application in minutes

Tutorial

Learn Flask with a complete example application

Build docs developers (and LLMs) love