6

I googled and couldn't find a solution to my nice problem: I have Ubuntu and I want to program a ESP32 ............... I tried a lot of pip commands ... but it didnt work. You have any idea how to install the correct packages? Maybe you can tell me what to do. I am really lost. I tried it last year and also failed.. Now I want to try it another time :)

   /.arduino15/packages/esp32/tools/esptool_py/3.0.0/esptool.py", line 38, in <module>
        import serial
    ImportError: No module named serial
jento
  • 65
  • 1
  • 1
  • 2

4 Answers4

9

Open terminal and enter this command python -m pip install pyserial it will download pyserial for you and you will not receive the above error. The above error is because you don't have pyserial installed on the system.

The related documentation for pyserial could be found here

Maaz Sk
  • 345
  • 3
  • 16
4

I had the same issue compiling the CameraWebServer example. I'm using Ubuntu 20.04. The problem occurs during the linking stage when the script invokes python. On my system this runs the system python which is python 2.7.18. I don't think the serial module (supplied by pyserial) is available on Ubuntu 20.04 for python 2.x.

My solution was first to abandon the Arduino IDE and use the arduino-cli to compile the example. I created a virtual python 3 environment, activated it, installed pyserial under the virtual environment and run arduino-cli to make the runtime. The python scripts appear to be compatible with python 3.

candor
  • 41
  • 2
1

Problem resolved, Thank you. I had installed pyserial. The error surprisingly was related to the incorrect processor speed (!) in the Arduino IDE. I have no idea why that would influence the serial/pyserial function.

Big Bob
  • 11
  • 1
1

Reference: https://www.how2shout.com/linux/how-to-install-python-2-7-on-ubuntu-20-04-lts/

I think Arduino IDE expects Python2 to be installed. My Version is Arduino-1.8.13 You also need Python2 modules so you need to install pip2

:~/curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py :~/sudo python2 get-pip.py :~/pip2 install pytools :~/pip2 install pyserial