python / python/mypy

Mypy suggests `types-Pygments` but `--install-types` doesn't install it

Open
#21,068 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Bug Report

(A clear and concise description of what the bug is.)
See below.

To Reproduce

Do from pygments.lexers import ....

mypy file.py would gives:

(3.14) ➜ git: mypy .
error: Library stubs not installed for "pygments.lexers"  [import-untyped]
note: Hint: "python3 -m pip install types-Pygments"
note: (or run "mypy --install-types" to install all missing stub packages)
note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
error: Library stubs not installed for "pygments"  [import-untyped]

Normally for other packages I would fix by mypy --install-types [--non-interactive] ..

But it doesn't install types-Pygments despite mypy knowing that this stub is missing.

# Ideally, a small sample program that demonstrates the problem.
# Or even better, a reproducible playground link https://mypy-play.net/ (use the "Gist" button)

Expected Behavior

Actual Behavior

Your Environment

  • Mypy version used: mypy 1.19.1 (compiled: yes)
  • Mypy command-line flags: See above
  • Mypy configuration options from mypy.ini (and other config files): No
  • Python version used: Python 3.14.3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported mypy . failure with from pygments.lexers import ..., then trace the --install-types --non-interactive path that handles the missing types-Pygments package. Done means the command installs the suggested stub package and the reported missing-stub diagnostics no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.