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.
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
- Check the spelling:
math,random,statistics,datetime. - Module names are lowercase.
- Do not name your own file after a module, for example
random.py.