I am in the process of making a portable Arduino IDE system to allow access & upload of ino sketches to microcontrollers already installed in buildings on my property. I have a Raspberry Pi I am using for this setup. I have used it successfully to upload sketches to an Arduino Uno. The IDE being used on the PI is version 1.8.19.
My issue is with an ESP32 WROOM microcontroller. The compiler is generating an error regarding a module that is referenced called "serial." The ESP32 library package is installed in the IDE. This error does not occur on my other computer using a Linux based IDE platform.
I ran this command script hoping it would straighten things up:
Where should I look to correct this missing module file?
thanks for any ideas.....
Compiler error message:
Traceback (most recent call last):
File "/home/pi/.arduino15/packages/esp32/tools/esptool_py/3.1.0/esptool.py", line 38, in <module>
import serial
ImportError: No module named serial
Multiple libraries were found for "WiFi.h"
Used: /home/pi/.arduino15/packages/esp32/hardware/esp32/2.0.2/libraries/WiFi
Not used: /home/pi/Arduino/libraries/WiFiNINA
Not used: /opt/arduino-1.8.19/libraries/WiFi
exit status 1
Error compiling for board ESP32 Dev Module.
pi@raspberrypi:~ $ sudo pip install pyserial
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pyserial in /usr/lib/python3/dist-packages (3.5b0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
edit -
fyi:
pi@raspberrypi:~ $ pip3 show pyserial
Name: pyserial
Version: 3.5b0
Summary: Python Serial Port Extension
Home-page: https://github.com/pyserial/pyserial
Author: Chris Liechti
Author-email: cliechti@gmx.net
License: BSD
Location: /usr/lib/python3/dist-packages
Requires:
Required-by: mote
Several years ago when I tried to develop and upload code to an ESP32 from a RPI, I found out that ESPRESSIF no longer developed a core for the RPI. This may still be the case. You might inquire at ESP32 Forum - Index page.
There is an old ESP32 core that does work with the RPi. The core has to be complied on the RPi. For me, after 24 hours and it was still working on the compile of the core, I gave up. At the time ESPRESSIF's response was to use a PC.
pi@raspberrypi:~ $ python -m ensurepip
ensurepip is disabled in Debian/Ubuntu for the system python.
Python modules For the system python are usually handled by dpkg and apt-get.
apt-get install python-<module name>
Install the python-pip package to use pip itself. Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.
pi@raspberrypi:~ $ apt-get install python-pip
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
pi@raspberrypi:~ $ sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python-pip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
python3-pip
E: Package 'python-pip' has no installation candidate
pi@raspberrypi:~ $
/home/pi/.arduino15/packages/esp32/tools/esptool_py/3.1.0/esptool.py
shows version 3. 1 for python while terminal commands showed version 2.7.18. Is this discrepancy causing the compiler 'serial' module not found issue? What is correct path forward? I noticed the esptool.py file suggested:
"You may be able to work around this by 'pip uninstall serial; pip install pyserial'
but this may break other installed Python software that depends on 'serial'."
top section of shows version 3.1 of esptool.py [after initial comment area]:
from __future__ import division, print_function
import argparse
import base64
import binascii
import copy
import hashlib
import inspect
import io
import itertools
import os
import shlex
import string
import struct
import sys
import time
import zlib
try:
import serial
except ImportError:
print("Pyserial is not installed for %s. Check the README for installation instructions." % (sys.executable))
raise
# check 'serial' is 'pyserial' and not 'serial' https://github.com/espressif/esptool/issues/269
try:
if "serialization" in serial.__doc__ and "deserialization" in serial.__doc__:
raise ImportError("""
esptool.py depends on pyserial, but there is a conflict with a currently installed package named 'serial'.
You may be able to work around this by 'pip uninstall serial; pip install pyserial' \
but this may break other installed Python software that depends on 'serial'.
There is no good fix for this right now, apart from configuring virtualenvs. \
See https://github.com/espressif/esptool/issues/269#issuecomment-385298196 for discussion of the underlying issue(s).""")
except TypeError:
pass # __doc__ returns None for pyserial
try:
import serial.tools.list_ports as list_ports
except ImportError:
print("The installed version (%s) of pyserial appears to be too old for esptool.py (Python interpreter %s). "
"Check the README for installation instructions." % (sys.VERSION, sys.executable))
raise
except Exception:
if sys.platform == "darwin":
# swallow the exception, this is a known issue in pyserial+macOS Big Sur preview ref https://github.com/espressif/esptool/issues/540
list_ports = None
else:
raise
__version__ = "3.1"
MAX_UINT32 = 0xffffffff
MAX_UINT24 = 0xffffff
Still getting the ill-fated "ImportError: no module named serial".
terminal output:
pi@raspberrypi:~ $ pip3 install pyserial
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pyserial in /usr/lib/python3/dist-packages (3.5b0)
pi@raspberrypi:~ $ [quote="ZX80, post:11, topic:968605, full:true"]
Holy Crap!!!! Your suggestion was a winner!!!!
I hope you get a visit from the Publishers Clearinghouse Winner Announcement Team and they hand you a big fat check!!!!!