[Solved] Arduino "ModuleNotFoundError" in macOS

Greetings all,

I have a RAK3172 on an RAK3272S breakout board. I’m able to connect successfully via serial using a SiLabs CP2102N connected to my Mac. The device responds normally to AT commands via the Arduino console and WisToolBox seems works fine.

When I attempt to implement the Standalone RUI3 Example it fails at Step 9 with the following error:

PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.SLAB_USBtoUART, /dev/cu.usbserial-14210, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.SLAB_USBtoUART, /dev/tty.usbserial-14210, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.SLAB_USBtoUART, /dev/cu.usbserial-14210, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.SLAB_USBtoUART, /dev/tty.usbserial-14210, } => {}
Uploading using selected port: /dev/cu.SLAB_USBtoUART
python3 /Users/keck/Library/Arduino15/packages/rak_rui/tools/uploader_ymodem/1.0.0/uploader_ymodem.py -f /var/folders/xt/b2nqyds519x10nn0hytgbw5r0000gn/T/arduino_build_160172/Arduino_Digital-mod.ino.bin -p /dev/cu.SLAB_USBtoUART 
Traceback (most recent call last):
  File "/Users/keck/Library/Arduino15/packages/rak_rui/tools/uploader_ymodem/1.0.0/uploader_ymodem.py", line 6, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'
ModuleNotFoundError: No module named 'serial'

Some other searching suggested it might be a missing pyserial library, however it appears I already have this installed:

%pip install pyserial
Requirement already satisfied: pyserial in ./.pyenv/versions/3.9.0/lib/python3.9/site-packages (3.5)

Any advice on how to diagnose further?

Thanks!
-AD

Welcome to RAK forum @Autodog ,

There could be some python conflicts in your MacOS which I also experienced before.

Few insights I have.

  1. You can manually upload the firmware via using a separate terminal. You can execute this:
    python3 /Users/keck/Library/Arduino15/packages/rak_rui/tools/uploader_ymodem/1.0.0/uploader_ymodem.py -f /var/folders/xt/b2nqyds519x10nn0hytgbw5r0000gn/T/arduino_build_160172/Arduino_Digital-mod.ino.bin -p /dev/cu.SLAB_USBtoUART

  1. You can try to modify the upload script.

  1. You can reinstall python via sudo /usr/bin/python3 -m pip install pyserial

I am doing #1 for a long time. Then #3 reinstallation solves the issue for me.

Thanks for the quick response! Method #3 seems to have worked for me.

-AD