Read a Python traceback and fix the common setup errors instead of panicking.
When Python hits an error it prints a traceback: the chain of calls that led to the failure, ending with the error type and message. It looks alarming, but it is just a report.
The last line is the actual error type and message, and it is the most useful part. Read it first. The lines above show where it happened, which you only need once you know what went wrong.
Copy the exact error text. It names the problem, and often the file and line. Treat it as a clue to follow, not noise to skip.
| Message | What it means and where to look |
|---|---|
ModuleNotFoundError: No module named 'numpy' | numpy is not installed in the Python you are running. See Installing packages. |
command not found: python or 'python' is not recognized | Python is not installed, or not on your PATH. See Python setup. |
SyntaxError | A typo in the code, often a missing colon, bracket, or quote. The caret in the message points near it. |
IndentationError | Python uses indentation to mark blocks. A line is indented inconsistently with its neighbours. Make the indentation match. |
FileNotFoundError or "can't open file" | You are in the wrong folder or mistyped the filename. See Running Python. |
Recognising the handful above is enough to get through setup. For anything else, read the bottom line and search the exact message.