Interview Prep/Python for DevOps/Environments, imports & packaging errors

`mypy` reports `error: Library stubs not installed for "requests"` and `Skipping analyzing "boto3": module is installed, but missing library stubs or py.typed marker`.

BeginnerTroubleshootingEnvironments, imports & packaging errors
Answer

Likely causes → The libraries do not ship type information; mypy needs separate stub packages.

Diagnose → Read the hint mypy prints (python3 -m pip install types-requests).

Fix → pip install types-requests types-PyYAML "boto3-stubs[ec2,s3]", or mypy --install-types. For libraries without stubs, set ignore_missing_imports = true for that module in an override.

Prevent → Keep stub packages in dev dependencies with the same update group as the library.

All Python for DevOps questions Roadmap: Python for automation

More on Environments, imports & packaging errors