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:
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 ?
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.
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'
>>>
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
@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.
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.
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.