• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Import serial error with ESP32 on DOIT ESP32 REVKIT VI board

Q&A Forum › Category: ESP32 › Import serial error with ESP32 on DOIT ESP32 REVKIT VI board
0 Vote Up Vote Down
Ernest Jurkat asked 6 years ago

I installed the DOIT ESP32 REVKIT Vi board on Arduino 1.8.7. For all sketches, including Blink, on compiling I get the following error:
    File “/home/ernie-ssd/.arduino15/packages/esp32/tools/esptool/2.3.1/esptool.py”, line 34, in <module>
    import serial
    ImportError: No module named serial
    exit status 1Error compiling for board DOIT ESP32 DEVKIT V1.”
The error message first occurred when I copied and tried to compile the WI-Fi Scan test sketch.  Then I copied your Blink sketch, tried compiling and got the same error message. Blink doesn’t even have a line 34!

Question Tags: Import serial error with ESP32
13 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Hello Ernest,
When did you install the ESP32 add-on? Did you just install it today or did you have an older installation before?

0 Vote Up Vote Down
Ernest Jurkat answered 6 years ago

I  installed the DOIT ESP32 DEVKIT VI board on the Arduino IDE just before trying the sketches.  I had used the IDE for other arduino projects prior to that.

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Go to your Windows search bar, type “Command Prompt” and open it. Then, type the following and press Enter key: 

pip install pyserial

Did it install pyserial? Did it print any error message? 
Thanks!

0 Vote Up Vote Down
Ernest Jurkat answered 6 years ago

This Arduino is on a Linux Mint OS.  I had already installed pyserial 3.X (using Conda )to this computer but it is not in the folder ” “/home/ernie-ssd/.arduino15/packages/esp32/tools/esptool/2.3.1/esptool.py”
Can I just find and copy the pyserial file and paste it into 2.3.1?
I am very shallow in my knowledge of Linux operations

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

No, you can’t copy those files to that folder, because the file exists there. You need to install the serial module for python. Can you run these commands in your Terminal windows:

pip install pyserial

Or

pip3 install pyserial

Did it install? Can you re-open your Arduino IDE and try to upload the sketch again?

0 Vote Up Vote Down
Ernest Jurkat answered 6 years ago

I already installed pyserial using conda.  There is a bunch of pyserial 3.4 files in my Anaconda folder.
Should I use pip to install them again?

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Unfortunately I’ve never used Conda, so I don’t know how it works. I just know that the error means that your Pyserial library is not installed, or it can’t be found… 
If you type in your Terminal:

python --version

Which version do you have? Then, type:

python

The intepreter should begin, can you import:

import serial

What do you see? Did it import the serial module? 
Thanks!

0 Vote Up Vote Down
Ernest Jurkat answered 6 years ago

This is the result:
 
ernie-ssd@erniessd-desktop:~$ python –version
Python 3.7.0
ernie-ssd@erniessd-desktop:~$ python
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import serial
>>>

0 Vote Up Vote Down
Ernest Jurkat answered 6 years ago

I’m sure that the problem is that pyserial can’t be found, although it exists on this machine. I don’t understand enough to tell the ardunio IDE how to find what it needs, and pyserial has quite a few files!

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Can you try to remove Python 3.7 and use Python 2.7 in your computer?
After installing Python 2.7, remove the ESP32 board from the Arduino IDE, and re-install it. You can’t move those pyserial files, they should be automatically found and used… Thanks for your patience!

0 Vote Up Vote Down
Ernest Jurkat answered 6 years ago

I will try that

0 Vote Up Vote Down
Frank Burger answered 5 years ago

Probably way out of date …
sudo apt install python-serial
worked for me on Ubuntu 18.04

0 Vote Up Vote Down
cliff.e.hewitt answered 5 years ago

I just worked through the same problem.  I am running Linux Mint 20.  I had Python 2 and Python 3 installed, so I uninstalled Python 2.  I next got an error that python wasn’t found in my $PATH, so I added a link to python3 at /usr/bin/python.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.