Error importing plugin "pydantic.mypy": No module named 'pydantic'
See original GitHub issueChecks
- I added a descriptive title to this issue
- I have searched (google, github) for similar issues and couldn’t find anything
- I have read and followed the docs and still think this is a bug
Bug
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
pydantic version: 1.9.0
pydantic compiled: True
install path: /home/slado122/Programming/Tests/test_pydantic_mypy/.venv/lib/python3.10/site-packages/pydantic
python version: 3.10.2 (main, Jan 15 2022, 19:56:27) [GCC 11.1.0]
platform: Linux-5.16.15-arch1-1-x86_64-with-glibc2.35
optional deps. installed: ['typing-extensions']
...
Pydantic’s mypy plugin doesn’t work for me. The command to reproduce:
python -m venv .venv && source .venv/bin/activate && pip install pydantic && echo "[mypy]\nplugins = pydantic.mypy" > mypy.ini && touch a.py && mypy .
Output:
Collecting pydantic
Using cached pydantic-1.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.3 MB)
Collecting typing-extensions>=3.7.4.3
Using cached typing_extensions-4.1.1-py3-none-any.whl (26 kB)
Installing collected packages: typing-extensions, pydantic
Successfully installed pydantic-1.9.0 typing-extensions-4.1.1
WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
You should consider upgrading via the '/home/slado122/Programming/Tests/test_pydantic_mypy/.venv/bin/python -m pip install --upgrade pip' command.
mypy.ini:2: error: Error importing plugin "pydantic.mypy": No module named 'pydantic'
Found 1 error in 1 file (errors prevented further checking)
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Error importing plugin "pydantic.mypy": No module named ...
Error importing plugin "pydantic.mypy": No module named 'pydantic' # ... Must be a problem with how you have pydantic and/or mypy installed.
Read more >tiangolo/fastapi - Gitter
setup.cfg:27: error: Error importing plugin 'pydantic.mypy': No module named 'pydantic' Found 1 error in 1 file (checked 5 source files).
Read more >Mypy plugin - pydantic
If enabled, raise a mypy error whenever a field is declared on a model without explicitly specifying its type. Configuring the Plugin¶. To...
Read more >Usage with mypy - pydantic
Pydantic ships with a mypy plugin that adds a number of important pydantic-specific features to mypy that improve its ability to type-check your...
Read more >ModuleNotFoundError: No module named 'pydantic'
If you are getting the error while using pipenv then you need to install pydantic by using pipenv install pydantic command.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Must be a problem with how you have pydantic and/or mypy installed. Works fine for me.
why it’s closed? problem is actual