Moving Config Arduino IDE1.8.x

Hello again.

I have a problem moving my Arduino IDE-setup to another computer. It works on the first I installed it on 2 years ago, but not on the second. I'll describe software setup:

Computer1: Ubuntu Mate (Linux ) 20.04
hidden directory: ~/.arduino15
installation directory: ~/Data/SOFTWARE/Arduino/arduino-1.8.13/ (contains /library directory)
source code: ~/Data/ESP32-IOT2/ (also contains /library directory)

Computer2: Xubuntu (Linux) 22.04
hidden directory: ~/.arduino15
installation directory: ~/Apps/arduino-1.8.19/ (contains /library directory)
source code: ~/Data/ESP32-IOT2/ (also contains /library directory)

As you can see, I'm programming for the ESP32 now.
After running the setup script in the directory ~/Apps on C2, I also added the line https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json in the "preferences>settings>additional board mgrs." of the Arduino IDE. I activated the library Board Mgr. and they were all added/updated. I thought that was enough. Apparently not.

But now, If I want to inject a (any) sketch I developed on C1 in the directory ~/Data/ESP32-IOT2/, from exactly the same directory in C2, I get the following error:

Traceback (most recent call last):
  File "/home/user/.arduino15/packages/esp32/tools/esptool_py/4.2.1/esptool.py", line 31, in <module>
    import esptool
  File "/home/user/.arduino15/packages/esp32/tools/esptool_py/4.2.1/esptool/__init__.py", line 42, in <module>
    from esptool.cmds import (
  File "/home/user/.arduino15/packages/esp32/tools/esptool_py/4.2.1/esptool/cmds.py", line 14, in <module>
    from .bin_image import ELFFile, ImageSegment, LoadFirmwareImage
  File "/home/user/.arduino15/packages/esp32/tools/esptool_py/4.2.1/esptool/bin_image.py", line 14, in <module>
    from .loader import ESPLoader
  File "/home/user/.arduino15/packages/esp32/tools/esptool_py/4.2.1/esptool/loader.py", line 21, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'
exit status 1
Error compiling for board NodeMCU-32S.

What am I missing? Where did I go wrong, How can I repair this/make it work ?

Regards,
Jan

What is your sketchbook folder set to on both computers ?

C1, logon Jan: /home/jan/Data/ESP32-IOT2
C1, logon User: /home/user/Data/ESP32-IOT2

When I load the sketch on C1, and try to read the result from C2, I have to open the serial terminal.
Thèn I get the error:

Error opening serial port '/dev/ttyUSB0'. Try consulting the documentation at http://playground.arduino.cc/Linux/All#Permission

I'm going to do that ...

OK, following to the instructions I gave the local user access to the serial port, and (after a reboot) now I can open the Serial Monitor and see the msg. from the board.
BUT...
I still can't send a sketch to the ESP32. I still have exactly the same errors. See original post.

Back to square 1 ...

OK, somehow (Googling/verbose error output) I found out that it has to do with the library PySerial that's in Python installations. I found this:

How do I know if Pyserial is installed?
To check that it is installed, start Pyzo and at the command prompt type in: 
import serial If it just gives you another >>> prompt, all is good.

On C1, launching Python version 3.8.10, I just get another >>> prompt.
On C2, launching Python version 3.10.6, I get an error message:

>>> import serial
Traceback (most recent call last):
  File "<stdin>", line 1 in <module>
ModuleNotFoundError: No module named 'serial'
>>>

The above text is taken from a pdf, but the solution points to Pyzo and Blender, so I'm not willing to try that. https://www.techmonkeybusiness.com/pdfs/PySerial_Installation.pdf

It looks like another error on the forum, but the solution there is to change a configuration file. forum.arduino.cc/t/pyserial-and-esptools-directory-error/671804/14

Looking for "Python 3 pyserial missing" ... :frowning:

Found in How to Install 'Python-Serial' package on Linux? - GeeksforGeeks
it boils down to :

~$ sudo apt install python3-pip
~$ sudo pip3 install pyserial
~$ python3 -m pip show pyserial

I'll let you know if it works.

See you next year!

Regards,
Jan

I am confused as to whether you are programming the ESP32 in Python or C++

@UKHeliBob the "esptool" tool used by the ESP32 boards platform to upload is written in Python. So the tool itself is written in Python, but it is used to flash sketch binaries generated from Arduino/C++ code.

We are accustomed to the installation of a boards platform including all dependencies. The ESP32 boards platform is an exception to this in that they expect Python and the script's Python module dependencies to be pre-installed on Linux machines (they install a standalone executable built from the Python script for Windows and macOS users, since it is less likely those users will have Python installed and accessible). Users who don't happen to have those dependencies installed and accessible to the upload process might get cryptic errors about Python or modules being missing, even though the IDE correctly installed the ESP32 boards platform. These users must run some commands from the shell to resolve the error.

Thanks for the clarification regarding "esptool"

Can't help you there, with your confusion.
AFAIK, using the Arduino IDE, only C++ is possible.
And, it's not about programmming, it's about injecting the program into the ESP32.

Regards, (& Happy New Year!)
Jan

And C too, of course, but that was my point. You seemed to be getting errors related to Python but @ptillisch has explained why

That sums it up pretty nicely.

Though I can't remember having to have to do that with my previous installs. Then again, this was the first year I had to do that for the ESP32, the year before I had adapted the install for the ESP8266. So maybe ...

Or it can be that in my Ubuntu Mate 20.04 (C1) the complete Python package was (re-)installed, or completed, because I also followed courses in Python programming. The Xubuntu/C2-installation was a fresh one.

Anyway, I'm going to hang on to those commands.

Regards,
Jan

Well, I tried it, this morning... What a thing to do on the 1st of january! :rofl:

:fireworks: It works! :fireworks:

So, thanks for the feedback,
Have a good 2023 !
Regards,
Jan

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.