# How to Install Flask on Windows: Complete Setup Guide

> Install Flask on Windows easily. Follow our guide to set up Python, create a virtual environment, and install Flask using pip for your web development projects.

- Repository: [Pallets/flask](https://github.com/pallets/flask)
- Tags: getting-started
- Published: 2026-02-12

---

**To install Flask on Windows, install Python 3.8+, create a virtual environment with `python -m venv`, activate it with `.\venv\Scripts\activate`, and run `pip install Flask`.**

Installing Flask on Windows follows the standard Python package workflow documented in the official **pallets/flask** repository. Whether you're building a simple API or a complex web application, the process requires Python 3, pip, and optionally a virtual environment to isolate dependencies. This guide references the exact installation steps found in `docs/installation.rst` and [`README.md`](https://github.com/pallets/flask/blob/main/README.md) from the Flask source code.

## Prerequisites for Flask Installation on Windows

Before running installation commands, ensure Python is properly configured. According to the Flask repository's installation documentation, Flask requires **Python 3.8 or newer**.

Download the latest Python 3.x release from python.org and check the **"Add Python to PATH"** option during installation. This ensures that `python` and `pip` commands are available from PowerShell or Command Prompt without manual configuration.

## Step-by-Step Guide to Install Flask on Windows

### 1. Create an Isolated Virtual Environment

Creating a virtual environment prevents dependency conflicts between projects. The Flask project recommends this approach in its official documentation.

Open PowerShell or Command Prompt and run:

```powershell
python -m venv myenv

```

Activate the environment:

```powershell
.\myenv\Scripts\activate

```

For Command Prompt (cmd.exe), use:

```powershell
myenv\Scripts\activate.bat

```

### 2. Upgrade pip (Optional)

While not strictly required, upgrading pip ensures access to the latest package metadata:

```powershell
python -m pip install --upgrade pip

```

### 3. Install Flask Using pip

With the virtual environment activated, install Flask and its dependencies (Werkzeug, Jinja2, itsdangerous, and click):

```powershell
pip install Flask

```

This command pulls the latest stable version from PyPI as defined in the project's packaging configuration in [`src/flask/__init__.py`](https://github.com/pallets/flask/blob/main/src/flask/__init__.py).

### 4. Verify the Installation

Confirm Flask installed correctly by checking the version:

```powershell
python -c "import flask; print(flask.__version__)"

```

This imports from [`src/flask/__init__.py`](https://github.com/pallets/flask/blob/main/src/flask/__init__.py), which exposes the main Flask class and `__version__` attribute defined in the source distribution.

## Testing Your Flask Installation on Windows

Create a minimal application to test your setup. Save the following as [`hello.py`](https://github.com/pallets/flask/blob/main/hello.py):

```python
from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello, Flask on Windows!"

if __name__ == "__main__":
    app.run(debug=True)

```

Run the application:

```powershell
python hello.py

```

Open a browser and navigate to `http://127.0.0.1:5000/` to see the greeting. The `app.run()` method implemented in [`src/flask/app.py`](https://github.com/pallets/flask/blob/main/src/flask/app.py) handles the development server, while [`src/flask/cli.py`](https://github.com/pallets/flask/blob/main/src/flask/cli.py) provides the command-line interface for running production deployments.

## Troubleshooting Common Windows Installation Issues

Several Windows-specific problems can prevent successful installation:

- **`pip` not found**: Python was not added to PATH during installation. Re-run the Python installer and select "Add Python to PATH", or manually add `C:\PythonXX\Scripts` to your system environment variables.

- **`ImportError: No module named 'flask'`**: This occurs when Flask is installed outside the active virtual environment. Ensure you see `(myenv)` in your prompt before running Python, or verify you activated the correct environment with `.\myenv\Scripts\activate`.

- **Permission errors**: Installing packages into the system Python requires administrator privileges. Always use a virtual environment to avoid permission issues, or run Command Prompt as Administrator (not recommended for development).

## Summary

- Install Python 3.8+ from python.org with the "Add to PATH" option enabled
- Create and activate a virtual environment using `python -m venv` and `.\venv\Scripts\activate`
- Install Flask with `pip install Flask` to get the core framework and required dependencies
- Verify installation by importing flask and printing `flask.__version__` exposed in [`src/flask/__init__.py`](https://github.com/pallets/flask/blob/main/src/flask/__init__.py)
- Test with a minimal application using the Flask class from [`src/flask/app.py`](https://github.com/pallets/flask/blob/main/src/flask/app.py)

## Frequently Asked Questions

### Do I need administrator privileges to install Flask on Windows?

No, if you use a virtual environment. Installing Flask into a virtual environment created with `python -m venv` does not require admin rights. Only system-wide Python installations require elevated permissions, which is why the Flask documentation in `docs/installation.rst` recommends virtual environments for development.

### How do I upgrade Flask to the latest version on Windows?

Run `pip install --upgrade Flask` within your activated virtual environment. This command queries PyPI for the latest release and updates the package while preserving your virtual environment's isolation from system Python packages.

### Can I install Flask using conda instead of pip on Windows?

Yes, Anaconda users can run `conda install -c conda-forge flask` as an alternative to pip. However, the official Flask repository at pallets/flask maintains the pip package as the primary distribution method documented in the [`README.md`](https://github.com/pallets/flask/blob/main/README.md) and installation guides.

### Why does Flask recommend using a virtual environment on Windows?

Virtual environments prevent dependency conflicts between projects and avoid permission issues with the Windows system Python. As implemented in the Flask CLI ([`src/flask/cli.py`](https://github.com/pallets/flask/blob/main/src/flask/cli.py)), virtual environments ensure that the `flask` command and your application use consistent package versions without modifying system-wide Python installations.