Mar 2, 2019 1 min read

How to Fix ESP32 Compiler Error in Arduino IDE: /heltec/esp32/tools/esptool/ No module named

Table of Contents

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 as list_ports

/heltec/esp32/tools/esptool/ No module named

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 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 install

4.  That's it! Close the Arduino IDE and reopen it and you should be good to go!

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to The Engineer's Workshop.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.