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!
Hello Ernest,
When did you install the ESP32 add-on? Did you just install it today or did you have an older installation before?
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.
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!
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
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?
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?
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!
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
>>>
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!
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!
Probably way out of date …
sudo apt install python-serial
worked for me on Ubuntu 18.04