March 2

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.

  1. First, we need to download pyserial. Go to https://pypi.org/project/pyserial/#files and download the latest .tar.gz file you see there.
  2. Unpack the .tar.gz file you just downloaded. This will give you your install folder.
  3. 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!


Tags: , , ,
Copyright 2019. All rights reserved.

Posted March 2, 2019 by engineer in category "Microcontrollers

3 COMMENTS :

  1. By Jean on

    Rappel concernant les règles de confidentialité de GoogleConsulter maintenantJe les lirai plus tard

    Thank you. a lot I was looking for a solution since this morning. (Xubuntu 18.04 and Adafruit Feather ESP32)
    cordially

    Reply
  2. By engineer (Post author) on

    Thank you for leaving a comment, Jean, and letting me know! I remember when I was researching the problem when it happened to me, it seemed like a pretty common issue with very few answers. Glad to hear it worked out for you!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *