Write Python. Understand every error.

Open the editor

Error guide · Other errors

ModuleNotFoundError: No module named

Python could not find the module you tried to import.

Example

import maths
print(maths.sqrt(16))

What Python says

ModuleNotFoundError: No module named 'maths'

As printed by Python 3.12. Other versions may word it slightly differently.

Try this code in Py-CRAFT

Why it happens

The module name is misspelled, or the module is not available. Py-CRAFT runs Python in the browser, so modules that need installing with pip (like pandas or matplotlib) are not available. NumPy is available as a teaching version.

How to fix it

import math
print(math.sqrt(16))

Output: 4.0

Tips

Learn the ideas behind it

Other common errors

Share this page: