Score:0

arduino IDE import serial ImportError: No module named serial

ng flag

I want to program my ESP32 as I did 100000000000 times before. Now I want to try it on linux ubuntu :) In preferences I put in the *.json link and installed the espressif board. I think I chose the right board. Something is wrong with the serial port: When I click on board information it shows some serial number

BN: Unbekanntes Board
VID: 10C4
PID: EA60
SN: Laden Sie ir(...)

But when I want to upload it to the board it just shows:

Traceback (most recent call last):
  File "/root/.arduino15/packages/esp32/tools/esptool_py/3.0.0/esptool.py", line 38, in <module>
    import serial
ImportError: No module named serial
exit status 1
Fehler beim Kompilieren für das Board DOIT ESP32 DEVKIT V1.

I also did pip install pyserial ~$ python --version Python 2.7.18

hmm there must also be something wrong?

~$ sudo ls -l /dev/ttyUSB0
crw-rw----+ 1 root dialout 188, 0 Sep  8 15:02 /dev/ttyUSB0

I can open Arduino IDE with sudo, which is with root i think. And also with my account without sudo. .. I have different workspaces i think because i needed to install the board again, when I opened Arduino IDE with sudo .. actually I dont know what dialout is maybe I did it by mistake when installing esp support-.- ..

I also tried to change the group and give all permission via chmod 777 but it doesnt work

/dev# ls -l ttyUSB0 
crwxrwxrwx+ 1 root root 188, 0 Sep  8 15:02 ttyUSB0

anyway after put esp32 out and in again ttyUSB0 chmod777 config is resetted ............................

ls -l ttyUSB0
crw-rw----+ 1 root dialout 188, 0 Sep  8 15:36 ttyUSB0

I also checked my esp32 board now on w10 and there is no problem. Installation was done in 10 minutes (with a big break, making a banana shake xD)

N0rbert avatar
zw flag
Does this answer your question? [How to install latest Arduino IDE?](https://askubuntu.com/questions/1025753/how-to-install-latest-arduino-ide) ← You should not run Arduino IDE as root. Instead add your user to dialout group, install Arduino IDE using ubuntu-make and then install ESP32 tools as ordinary user.
Score:0
tw flag

Here is where I just found the solution, fellows! I installed pyserial in every way without results, but this one worked!

https://www.esp32.com/viewtopic.php?f=19&t=26670

  1. Open a terminal;
  2. Type in 'sudo apt install python-is-python3'

This package is about 500 Mega bytes big, but it did the trick I was expecting for months.

Will avatar
id flag
Could you put the steps in your answer? If the link breaks your answer won’t be useful any more. Thanks!
José Carlos de Moraes avatar
tw flag
Thank you so much for your reply, sir! I will proceed this way from now on!
Score:0
cn flag

I had this problem and I tried below codes, and it worked for me:

sudo apt-get install python-serial -y

or if you are using the python3 try:

sudo apt-get install python3-serial -y

Also use lower baudrate as you can see below: enter image description here

tbnsilveira avatar
us flag
Thank you for this answer, very helpful. I had first installed pyserial, which didn't work.
Score:0
ng flag

I had the same problem.

The problem was that I have multiple python versions installed and serial was only available for python 3.

Check if serial is installled for python version 2:

ls /usr/local/lib/python2.7/dist-packages/

If it doesn't appear, copy the library from python version 3:

sudo cp -r /usr/local/lib/python3.8/dist-packages/serial/ /usr/local/lib/python2.7/dist-packages/
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.