← Back to Error Guide
ModuleNotFoundError

How to Fix ModuleNotFoundError

Raised when Python cannot find a module you are trying to import.

What is ModuleNotFoundError?

ModuleNotFoundError occurs when Python tries to import a module that is not installed or not available in the current environment. This typically happens when the module is missing or the import statement has a typo.

Common Causes

How to Fix

  1. Verify the module name is spelled correctly in the import statement.
  2. Install the missing module using pip (e.g., pip install module-name).

Wrong Code

# Wrong code that causes error
import reqeusts  # Typo in module name

Correct Code

# Correct code
import requests  # Correct module name

More Python Error Guides