Skip to content

Mypy suggests installing "types-requests" when it is already installed #16400

@lucemia

Description

@lucemia

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions