Skip to content
Latchkey

mypy --ignore-missing-imports: Silence Untyped Deps

mypy --ignore-missing-imports stops mypy from erroring when an imported package has no type information.

Many libraries ship no stubs. This flag mutes the resulting noise, but used globally it also hides real typos in import paths, so prefer scoping it.

What it does

mypy --ignore-missing-imports tells mypy to treat any import it cannot resolve type information for as Any rather than reporting an error. It applies to both genuinely untyped packages and modules mypy simply cannot find.

Common usage

Terminal
mypy --ignore-missing-imports src/
# scope it to one package in config instead of globally
# (pyproject.toml)
# [[tool.mypy.overrides]]
# module = "thirdparty.*"
# ignore_missing_imports = true

Options

Flag or keyWhat it does
--ignore-missing-importsSuppress all unresolved-import errors (CLI, global)
ignore_missing_importsSame as a per-module override key in config
--follow-imports=skipRelated: do not analyze followed modules
--install-typesAlternative: fetch stub packages instead of ignoring

In CI

Using the global flag masks "Cannot find implementation or library stub for module" for typos too. Prefer per-module ignore_missing_imports overrides so a misspelled internal import still fails. Where stubs exist (for example types-requests), --install-types is better than ignoring.

Common errors in CI

Without this flag you get "error: Cannot find implementation or library stub for module named 'X' [import-untyped]" or "[import-not-found]". Globally ignoring hides a real broken import that should fail; scope the override to the specific untyped package instead.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →