How to Install mypy in Python

v1.20.0 CLI & Utilities Python >=3.10

Optional static typing for Python

Install pip install mypy

What is mypy?

Optional static typing for Python

Mypy -- Optional Static Typing for Python

Add type annotations to your Python programs, and use mypy to type check them. Mypy is essentially a Python linter on steroids, and it can catch many programming errors by analyzing your program, without actually having to run it. Mypy has a powerful type system with features such as type inference, gradual typing, generics and union types.

Quick Start

Minimal example to get started with mypy:

import mypy

print(mypy.__version__)

Installation

pip (standard)

pip install mypy

Virtual environment (recommended)

python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install mypy

pip3

pip3 install mypy

conda

conda install -c conda-forge mypy

Poetry

poetry add mypy

Dependencies

Installing mypy will also install these packages:

Verify the Installation

After installing, confirm the package is available:

python -c "import mypy; print(mypy.__version__)"

If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.

Installation Errors

Common errors when installing mypy with pip.

ModuleNotFoundError: No module named 'mypy'

Cause: The package is not installed in the current Python environment.

Fix: Run pip install mypy. If using a virtual environment, ensure it is activated first.

ModuleNotFoundError: No module named 'mypy' (installed but still failing)

Cause: pip installed the package into a different Python than the one running your script.

Fix: Use python -m pip install mypy to install into the interpreter you are running.

ImportError: cannot import name 'X' from 'mypy'

Cause: The function or class does not exist in the installed version.

Fix: Check the version with pip show mypy and upgrade with pip install --upgrade mypy.

pip: command not found

Cause: pip is not in PATH or Python was not added to PATH during installation.

Fix: Try python -m pip install mypy. On macOS/Linux try pip3.

PermissionError: [Errno 13] Permission denied

Cause: No write access to the system Python package directory.

Fix: Use a virtual environment, or add --user: pip install --user mypy

SSL: CERTIFICATE_VERIFY_FAILED

Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.

Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org mypy

Recent Releases

VersionReleased
1.20.0 latest 2026-03-31
1.19.1 2025-12-15
1.19.0 2025-11-28
1.18.2 2025-09-19
1.18.1 2025-09-11

Full release history on PyPI →

Manage mypy

Upgrade to latest version

pip install --upgrade mypy

Install a specific version

pip install mypy==1.20.0

Uninstall

pip uninstall mypy

Check what is installed

pip show mypy

Last updated: 2026-04-11 • Data from PyPI