Mypy suggests installing "types-requests" when it is already installed
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
Got Library stubs not installed for "requests.packages.urllib3.util.ssl_" [import-untyped] error.
Mypy suggest install types-requests but types-requests is already installed
To Reproduce
store the following line as reproduce.py
from requests.packages.urllib3.util.ssl_ import create_urllib3_context
Execute
(genv-studio-py3.10) ➜ gstudio git:(dependabot/pip/mypy-1.6.1) ✗ mypy reproduce.py --install-types --non-interactive
Installing missing stub packages:
/Users/davidchen/repo/gstudio/.venv/bin/python -m pip install types-requests
Requirement already satisfied: types-requests in ./.venv/lib/python3.10/site-packages (2.28.11.5)
Requirement already satisfied: types-urllib3<1.27 in ./.venv/lib/python3.10/site-packages (from types-requests) (1.26.25.4)
[notice] A new release of pip available: 22.3.1 -> 23.3.1
[notice] To update, run: pip install --upgrade pip
reproduce.py:1: error: Library stubs not installed for "requests.packages.urllib3.util.ssl_" [import-untyped]
reproduce.py:1: note: Hint: "python3 -m pip install types-requests"
reproduce.py:1: note: (or run "mypy --install-types" to install all missing stub packages)
reproduce.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
Expected Behavior
- no error (which is true in mypy 1.4.1)
Actual Behavior
- raise
error: Library stubs not installed for "requests.packages.urllib3.util.ssl_" [import-untyped]
Your Environment
- Mypy version used: 1.6.1
- Mypy command-line flags: --install-types --non-interactive
- Mypy configuration options from
mypy.ini(and other config files):
ignore_missing_imports = True
show_error_codes = True
implicit_optional = True
exclude = .*/(migrations|commands|scripts)/.*
- Python version used: 3.10.8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduce.py example and run the reported mypy 1.6.1 command using the installed types-requests package, then compare the behavior with mypy 1.4.1. Trace how missing-import diagnostics detect installed stub packages; done means the command no longer suggests reinstalling types-requests or reports the import-untyped error.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100