Install pyserial, not serial. The package is named pyserial but imported as serial.
What the message means
A different package called serial exists and breaks the import. Also, pip may install for a different Python than the one you run.
Fix it in this order
- Uninstall the package named serial if it is installed.
- Install pyserial with pip for the same Python you run.
- Use python -m pip to be sure the versions match.
- Check the import with a one-line test.
- Use a virtual environment for each project.
- Check the port name and permission afterwards.
Why it happens
The module imported as serial is provided by the package pyserial. Installing a package named serial gives a different library that does not work. The error also appears when pip installed the package for a different Python from the one running your script.
Run pip uninstall serial, then pip install pyserial, and use the same interpreter for both, for example python -m pip install pyserial.
If you see this, do this
| You see | Do this |
|---|---|
| Module not found | Package missing for this Python. |
| Has no attribute Serial | Wrong serial package. |
Related
serial permission, Serial Monitor blank.
Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.