ModuleNotFoundError
The exception raised when import cannot find a module with the given name.
In more detail
It usually means the package is not installed in the Python that is running, often because a different interpreter or an inactive virtual environment is in use. Check sys.executable and install with python -m pip. It is a subclass of ImportError.
Related terms
- exception — An error object a program raises to stop normal flow and report that something went wrong.
- traceback — The report Python prints when an unhandled exception stops a program, listing the chain of calls that led there and ending with the error.
Taught in
- Installing Python On Linux — Hands-on Python: Complete Video Course & Book
- Reading A Traceback Like A Professional — Hands-on Python: Complete Video Course & Book
- Packages, And Your Own Library — Hands-on Python: Complete Video Course & Book
- Import Variants, dir() And sys.path — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Modules Sprint — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep