Naked python does not run outside app lab

I can SSH into the Q, create a virt env for python, write a sample bit of python code but the location of arduino.app_utils is a mystery. Error looks like this:
(test-ide) arduino@Test1:~/ArduinoApps/test-ide/python$ python main.py

Traceback (most recent call last):

File "/home/arduino/ArduinoApps/test-ide/python/main.py", line 3, in

from arduino.app_utils import App

ModuleNotFoundError: No module named 'arduino'

(test-ide) arduino@Test1:~/ArduinoApps/test-ide/python$

First timers should read the pinned post re 'How to get the most from the forum'

I also need some normal python with access to hardware (bluetooth sound), what I did as a workaround - created simple web service with AI, and call it from app python container (it seems like file system is isolated but 172.17. 0.1 is always available from container)

I also searched the internet to solve this problem. I could not find out which package should be installed on my computer because I wanted to test the py file outside Arduino UNO Q. Both pyserial and arduino-python packages were not working. I think some library names 'arduino' is pre-installed on Arduino UNO Q. I also could not find 'pip' and 'pip3' on UNO Q.

I did find the source code thru the arduino-app-cli. Turns out that the cli is creating a docker container using several docker images. These images build with source in GitHub - arduino/app-bricks-py: The code of the Arduino App Lab Bricks. Down in the guts of this source is the actual python code that makes up the bridge, utils etc...: src/arduino/app_utils. Basically, the app lab creates a container system to run your main.py ans sketches using very specific binaries....

For each release of the Bricks, Arduino provides a Python wheel file containing the arduino package that is preinstalled in the App container.

The file is published as a GitHub release asset, so can be downloaded from the link under the "Assets" section of the release page:

This will serve as the most convenient way to install the package independently.

Thank you for the update. I think the approach will be fine for most people, however, I am also interested in very slim and hardened images. Its early in development on the Q but hope to end up with k3s running to provide the container management and no have docker / compose at all. Kubernetes isn't for the faint of heart but I've been working to include in edge devices for quite some time. Thanks again.

Nice!

It would be great if you would post an update with your findings as you progress in the project. I'm sure the forum community will be interested in this subject.