How to Fix ESP32 Compiler Error in Arduino IDE: /heltec/esp32/tools/esptool/esptool.py No module named serial.tools.list_ports
So you’ve installed one of the various ESP32 board managers for the Arduino IDE. You go to compile your code and you get the following message:
Trackback arduino line 35, in <module> import serial.tools.list_ports as list_ports /heltec/esp32/tools/esptool/esptool.py No module named serial.tools.list_ports
You’ve already installed pyserial so what the heck is going on? Well, fun fact, your Arduino ESP32 board manager uses Python 2.7 and you probably have Python 3.+ installed. The Arduino IDE is trying to use pyserial and it can’t find it because it’s using Python 2.7 and you installed pyserial for use with Python 3. Thankfully the fix is simple enough.
- First, we need to download pyserial. Go to https://pypi.org/project/pyserial/#files and download the latest .tar.gz file you see there.
- Unpack the .tar.gz file you just downloaded. This will give you your install folder.
- Open this folder in your terminal and run the following command so we install pyserial for Python 2.x:
sudo python2 setup.py install
4. That’s it! Close the Arduino IDE and reopen it and you should be good to go!