python / python/mypy

--python-executable doesn't discover plugins

Open
#21,621 0 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

When using --python-executable with globally installed mypy, it discovers the packages installed in the virtualenv, but not the installed plugins

To Reproduce

  1. Use globally installed mypy
  2. python -m venv .venv
  3. .venv/bin/pip install pydantic
  4. echo pass > main.py
  5. In pyproject.toml:
[tool.mypy]
plugins = ["pydantic.mypy"]
  1. mypy --python-executable .venv/bin/python main.py

Expected Behavior

It should pass with no errors, just like it does when installed inside of the virtualenv

Actual Behavior

pyproject.toml:1: error: Error importing plugin "pydantic.mypy": No module named 'pydantic'  [misc]
Found 1 error in 1 file (errors prevented further checking)

Your Environment

  • Mypy version used: 2.1.0
  • Python version used: 3.14.6

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 running the documented reproduction with main.py, pyproject.toml, and --python-executable .venv/bin/python. Trace how mypy resolves plugins versus packages from the selected interpreter; done means pydantic.mypy loads successfully and the command completes without errors.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.