Greetings, my question is: is there an official way of choosing a python version other than 3.13 to run the code?
Context
I want to make a middle finger gesture detector through a webcam plugged to the arduino (by the way I managed to do it but it is very slow, more on that later). The "Official" way is actually using the bricks in the App Lab, which I am not exactly comfortable with for now because of many reasons, and there is a guide on Edge Impulse website on how to create a .eim model and put it inside the board's file and make the video brick thing use that model. However I did not really have enough time to gather the data and train a network and everything so I was set to use something already existing to test it.
So i found out that mediapipe has something that can be used for that exactly, it basically takes a frame and gives the hand's landmarks coordinates in space which you can use with lots of ifs to check if someone is giving you the finger. Now here is the issue, mediapipe doesnt work with python 3.13 at the time of this writing (thanks chatgpt for letting me know that).
Workaround that I use for now
This involves running python scripts directly on the board, not inside docker, and not from App Lab.
Install python 3.11
The first step is installing python 3.11, which is not available from apt so you have to build it (takes a looooooong time on the board , drink a coffee or something).
First you have to ssh into your board ( or use adb shell, or just run on the board itself) and go into a folder you like
sudo apt update
sudo apt install -y build-essential libssl-dev zlib1g-dev \
libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev \
libffi-dev libbz2-dev liblzma-dev wget
wget https://www.python.org/ftp/python/3.11.8/Python-3.11.8.tgz
tar xvf Python-3.11.8.tgz
cd Python-3.11.8
./configure --enable-optimizations
make -j$(nproc)
sudo make altinstall
Note: the make altinstall thing is gonna use python3.11 instead of python3 so python3 still points to python 3.13, oh and one of configure or make might have some error/warning messages but it works out eventually.
Now it should be installed and you can create a venv, for example I just made a folder called finger and cd into it then run those
python3.11 -m venv finger_env
source finger_env/bin/activate
pip install --upgrade pip setuptools wheel
pip install mediapipe
This basically creates a venv called finger_env inside the folder, and whenever you want to use python3.11 with that project's dependencies you can just do the source command and you terminal will now look like this
(finger_env) arduino@lexi:~/finger$
Note: you also need to install opencv to have access to the webcam, and it will depend on your setup but for me the webcam was in video2, video0 and video1 did not work I dont know what they are for, and there was video3 and media as well when the webcam was plugged in but i havent figured out what those were for yet.
cap = cv2.VideoCapture("/dev/video2")
The bridge
Now you might have noticed it but none of the python bridge (and other libs) files are visible in the AppLab... So how can we use the birdge to tell the mcu to draw a pretty text when midfinger is detected? Well after digging around it turns out the files are injected from a docker image that comes from this repo.
Now a sane person would actually follow the guide and everything (like maybe try to install the whl file but it fails because of a python version requirement because I downgraded) , but I just needed the bridge so...
Copy the bridge file and paste it as Bridge.py in your project folder, and edit the file to have logger instead of .logger. Also copy the logger file and name it logger.py.
And now you can use the bridge, although the syntax differs a tiny little bit from the syntax of the examples in app lab so you can take a look at the examples.
I assume you can do the same kind of "patching" to use any other python libraries.
The Arduino
I use the Arduino IDE 2.something version, mainly because I cant look at the monitor in the AppLab without recompiling and reuploading and rerunning everything, where as in the IDE I can even compile and know without waiting too much that my code doesnt compile because i forgot a semicolon.
Anyway, this is straightforward just add the board, select Arduino Uno Q as the type, and you're good to go. There are examples for the Arduino Uno Q in File > Examples ...
Oh and this might be obvious to some but not to me, if you include a library (even the examples themselves need this actually) you have to go to the library icon on the left, search for your package (Arduino_RouterBridg for example, or the matrix thing just look at the h file name) and install it before the code can actually compile.
Thanks for reading, although 90% of it was me ranting I hope someone can make use of it , and I hope my question finds an answer later, and I hope it is not a very simple answer like adding an env var pyversion=something which would have made my hours of debugging things useless haha .