DESK-MX6-L-AN-0011: Using Python for Embedded applications

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box


200px-Emblem-important.svg.png

This application note has been validated using the kit version in the History table.


History
Issue Date Notes
2024/06/04 DESK-MX6-L 4.0.1


Introduction[edit | edit source]

As found on Python official website, Python is a programming language that lets you work more quickly and integrate your systems more effectively and also Python can be easy to pick up whether you're a first-time programmer or you're experienced with other languages.

These sentences got a real confirmation if you have a look at the IEEE Top Programming Languages 2021 ranking. As you can see in the following picture Python reached the Top of the ranking even more than the native C language used since the beginning in Embedded systems programming:


IEEE Top programming languages 2021 - Embedded


As reported in this article The C/C++ programming languages dominate embedded systems programming, though they have a number of disadvantages. Python, on the other hand, has many strengths that make it a great language for embedded systems.

This application note provides some examples of software packages installation that can be used for building an Industrial IoT Gateway adding python3 libraries to the AXEL Lite platform.

Python on DESK[edit | edit source]

python3 application is already present on DESK-MX6-L dave-image-devel root file system.

Installing python packages[edit | edit source]

First of all check for the default installed python/pip version in the DESK-MX6-L root file system:

root@desk-mx6:~# python3 --version
Python 3.10.7
root@desk-mx6:~#

pip3 is not present - by default - on standard root file system, but can be easily installed using dnf and DaVE Embedded Systems' pre-built packages:

root@desk-mx6:~# dnf install python3-pip
============================================================================================================================================
 Package                                Architecture                     Version                     Repository                        Size
============================================================================================================================================
Installing:
 python3-pip                            cortexa9t2hf_neon                22.0.3-r0                   cortexa9t2hf_neon                2.6 M
Installing dependencies:
 python3-2to3                           cortexa9t2hf_neon                3.10.7-r0                   cortexa9t2hf_neon                164 k
 python3-asyncio                        cortexa9t2hf_neon                3.10.7-r0                   cortexa9t2hf_neon                231 k
 python3-compile                        cortexa9t2hf_neon                3.10.7-r0                   cortexa9t2hf_neon                 25 k
 python3-ctypes                         cortexa9t2hf_neon                3.10.7-r0                   cortexa9t2hf_neon                 85 k
...
...
Installed:
  python3-2to3-3.10.7-r0.cortexa9t2hf_neon                          python3-asyncio-3.10.7-r0.cortexa9t2hf_neon
  python3-compile-3.10.7-r0.cortexa9t2hf_neon                       python3-ctypes-3.10.7-r0.cortexa9t2hf_neon
  python3-difflib-3.10.7-r0.cortexa9t2hf_neon                       python3-image-3.10.7-r0.cortexa9t2hf_neon
  python3-mmap-3.10.7-r0.cortexa9t2hf_neon                          python3-multiprocessing-3.10.7-r0.cortexa9t2hf_neon
  python3-pip-22.0.3-r0.cortexa9t2hf_neon                           python3-pkg-resources-59.5.0-r0.cortexa9t2hf_neon
  python3-plistlib-3.10.7-r0.cortexa9t2hf_neon                      python3-setuptools-59.5.0-r0.cortexa9t2hf_neon
  python3-unittest-3.10.7-r0.cortexa9t2hf_neon                      python3-xmlrpc-3.10.7-r0.cortexa9t2hf_neon

Complete!
root@desk-mx6:~#

After the installation, pip3 is the version available for Python 3.10.7:

root@desk-mx6:~# pip3 --version
pip 22.0.3 from /usr/lib/python3.10/site-packages/pip (python 3.10)
root@desk-mx6:~#

Virtual environments[edit | edit source]

As explained on python3 12. Virtual Environments and Packages tutorial it is better to "create a virtual environment, a self-contained directory tree that contains a Python installation for a particular version of Python, plus a number of additional packages"

This avoids the problem related to Applications that sometimes need a specific library version. In this way, it is possible to install the required packages (with their specific version required) only in this virtual environment (which may differ from the root installation).

  • first of all, install the venv python3 package - again - using dnf
root@desk-mx6:~# dnf install python3-venv
Last metadata expiration check: 0:04:45 ago on Tue Jun  4 11:50:04 2024.
Dependencies resolved.
============================================================================================================================================
 Package                        Architecture                        Version                       Repository                           Size
============================================================================================================================================
Installing:
 python3-venv                   cortexa9t2hf_neon                   3.10.7-r0                     cortexa9t2hf_neon                    23 k

Transaction Summary
============================================================================================================================================
Install  1 Package

Total download size: 23 k
Installed size: 52 k
Is this ok [y/N]: y
Downloading Packages:
python3-venv-3.10.7-r0.cortexa9t2hf_neon.rpm                                                                231 kB/s |  23 kB     00:00
--------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                       209 kB/s |  23 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                    1/1
  Installing       : python3-venv-3.10.7-r0.cortexa9t2hf_neon                                                                           1/1
  Verifying        : python3-venv-3.10.7-r0.cortexa9t2hf_neon                                                                           1/1

Installed:
  python3-venv-3.10.7-r0.cortexa9t2hf_neon

Complete!
root@desk-mx6:~#
  • create the virtual environment named - for example - desk
root@desk-mx6:~# python3 -m venv desk
root@desk-mx6:~#
  • activate the virtual environment
root@desk-mx6:~# source desk/bin/activate
(desk) root@desk-mx6:~#
  • update pip3 in the the virtual environment
(desk) root@desk-mx6:~# python3 -m pip install --upgrade pip
Requirement already satisfied: pip in ./desk-env/lib/python3.10/site-packages (22.2.2)
Collecting pip
  Downloading pip-24.0-py3-none-any.whl (2.1 MB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 2.1/2.1 MB 2.4 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.2.2
    Uninstalling pip-22.2.2:
      Successfully uninstalled pip-22.2.2
Successfully installed pip-24.0
(desk) root@desk-mx6:~#
  • setuptools can be upgraded too:
(desk) root@desk-mx6:~# pip3 install --upgrade setuptools
Requirement already satisfied: setuptools in ./desk-env/lib/python3.10/site-packages (63.2.0)
Collecting setuptools
  Downloading setuptools-70.0.0-py3-none-any.whl.metadata (5.9 kB)
Downloading setuptools-70.0.0-py3-none-any.whl (863 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 863.4/863.4 kB 2.1 MB/s eta 0:00:00
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 63.2.0
    Uninstalling setuptools-63.2.0:
      Successfully uninstalled setuptools-63.2.0
Successfully installed setuptools-70.0.0
(desk) root@desk-mx6:~#

Afterword, the wheel package is worth to be installed for further package installation:

(desk) root@desk-mx6:~# pip3 install wheel
Collecting wheel
  Downloading wheel-0.43.0-py3-none-any.whl.metadata (2.2 kB)
Downloading wheel-0.43.0-py3-none-any.whl (65 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 65.8/65.8 kB 369.0 kB/s eta 0:00:00
Installing collected packages: wheel
Successfully installed wheel-0.43.0
(desk) root@desk-mx6:~#

pip package installation[edit | edit source]

For the purposes of this Application Note, pip3 has been used to install some python packages typically used in an Industrial Gateway equipment

In this example, the following packages are installed:

  • pyserial and pymodbus (for bus communications)
  • flask
  • fastapi (web framework)
  • bottle (lightweight WSGI micro web-framework)
  • requests (HTTP library)
  • schema
  • ssdp, scapy (network packet manipulation)
  • ujson (JSON framework)
  • asyncua (OPCUA client and server library)
  • bcrypt (password hashing)
  • can (color animator)
  • cbor (Concise Binary Object Representation - CBOR is comparable to JSON, has a superset of JSON’s ability)
  • netifaces (network interface info)
  • python-prctl (C extension for system call)
(desk) root@desk-mx6:~# pip3 install pyserial
Collecting pyserial
  Downloading pyserial-3.5-py2.py3-none-any.whl.metadata (1.6 kB)
Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 90.6/90.6 kB 482.2 kB/s eta 0:00:00
Installing collected packages: pyserial
Successfully installed pyserial-3.5
(desk) root@desk-mx6:~# pip3 install pymodbus
Collecting pymodbus
  Downloading pymodbus-3.6.8-py3-none-any.whl.metadata (14 kB)
Downloading pymodbus-3.6.8-py3-none-any.whl (185 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 185.4/185.4 kB 1.4 MB/s eta 0:00:00
Installing collected packages: pymodbus
Successfully installed pymodbus-3.6.8
(desk) root@desk-mx6:~# pip3 install flask
Collecting flask
  Downloading flask-3.0.3-py3-none-any.whl.metadata (3.2 kB)
Collecting Werkzeug>=3.0.0 (from flask)
  Downloading werkzeug-3.0.3-py3-none-any.whl.metadata (3.7 kB)
Collecting Jinja2>=3.1.2 (from flask)
  Downloading jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
Collecting itsdangerous>=2.1.2 (from flask)
  Downloading itsdangerous-2.2.0-py3-none-any.whl.metadata (1.9 kB)
Collecting click>=8.1.3 (from flask)
  Downloading click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Collecting blinker>=1.6.2 (from flask)
  Downloading blinker-1.8.2-py3-none-any.whl.metadata (1.6 kB)
Collecting MarkupSafe>=2.0 (from Jinja2>=3.1.2->flask)
  Downloading MarkupSafe-2.1.5.tar.gz (19 kB)
  Preparing metadata (setup.py) ... done
Downloading flask-3.0.3-py3-none-any.whl (101 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 101.7/101.7 kB 1.1 MB/s eta 0:00:00
Downloading blinker-1.8.2-py3-none-any.whl (9.5 kB)
Downloading click-8.1.7-py3-none-any.whl (97 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 97.9/97.9 kB 1.1 MB/s eta 0:00:00
Downloading itsdangerous-2.2.0-py3-none-any.whl (16 kB)
Downloading jinja2-3.1.4-py3-none-any.whl (133 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 133.3/133.3 kB 1.5 MB/s eta 0:00:00
Downloading werkzeug-3.0.3-py3-none-any.whl (227 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 227.3/227.3 kB 1.7 MB/s eta 0:00:00
Building wheels for collected packages: MarkupSafe
  Building wheel for MarkupSafe (setup.py) ... done
  Created wheel for MarkupSafe: filename=MarkupSafe-2.1.5-cp310-cp310-linux_armv7l.whl size=25315 sha256=eac191835bb696d54144d153477226ce9ee65173d839fd697e8f690f9c09d920
  Stored in directory: /home/root/.cache/pip/wheels/b6/62/2a/14e4ae067769a57af54289f65f20e0b76a5130cd7a19b7e8f9
Successfully built MarkupSafe
Installing collected packages: MarkupSafe, itsdangerous, click, blinker, Werkzeug, Jinja2, flask
Successfully installed Jinja2-3.1.4 MarkupSafe-2.1.5 Werkzeug-3.0.3 blinker-1.8.2 click-8.1.7 flask-3.0.3 itsdangerous-2.2.0
(desk) root@desk-mx6:~# pip3 install bottle
Collecting bottle
  Downloading bottle-0.12.25-py3-none-any.whl.metadata (1.8 kB)
Downloading bottle-0.12.25-py3-none-any.whl (90 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 90.2/90.2 kB 649.3 kB/s eta 0:00:00
Installing collected packages: bottle
Successfully installed bottle-0.12.25
(desk) root@desk-mx6:~# pip3 install requests
Collecting requests
  Downloading requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
Collecting charset-normalizer<4,>=2 (from requests)
  Downloading charset_normalizer-3.3.2-py3-none-any.whl.metadata (33 kB)
Collecting idna<4,>=2.5 (from requests)
  Downloading idna-3.7-py3-none-any.whl.metadata (9.9 kB)
Collecting urllib3<3,>=1.21.1 (from requests)
  Downloading urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)
Collecting certifi>=2017.4.17 (from requests)
  Downloading certifi-2024.6.2-py3-none-any.whl.metadata (2.2 kB)
Downloading requests-2.32.3-py3-none-any.whl (64 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 64.9/64.9 kB 680.0 kB/s eta 0:00:00
Downloading certifi-2024.6.2-py3-none-any.whl (164 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 164.4/164.4 kB 1.8 MB/s eta 0:00:00
Downloading charset_normalizer-3.3.2-py3-none-any.whl (48 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 48.5/48.5 kB 491.5 kB/s eta 0:00:00
Downloading idna-3.7-py3-none-any.whl (66 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 66.8/66.8 kB 678.3 kB/s eta 0:00:00
Downloading urllib3-2.2.1-py3-none-any.whl (121 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 121.1/121.1 kB 1.2 MB/s eta 0:00:00
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests
Successfully installed certifi-2024.6.2 charset-normalizer-3.3.2 idna-3.7 requests-2.32.3 urllib3-2.2.1
(desk) root@desk-mx6:~# pip3 install schema
Collecting schema
  Downloading schema-0.7.7-py2.py3-none-any.whl.metadata (34 kB)
Downloading schema-0.7.7-py2.py3-none-any.whl (18 kB)
Installing collected packages: schema
Successfully installed schema-0.7.7
(desk) root@desk-mx6:~# pip3 install ssdp
Collecting ssdp
  Downloading ssdp-1.3.0-py3-none-any.whl.metadata (7.0 kB)
Downloading ssdp-1.3.0-py3-none-any.whl (10.0 kB)
Installing collected packages: ssdp
Successfully installed ssdp-1.3.0
(desk) root@desk-mx6:~# pip3 install scapy
Collecting scapy
  Downloading scapy-2.5.0.tar.gz (1.3 MB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 1.3/1.3 MB 2.4 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: scapy
  Building wheel for scapy (setup.py) ... done
  Created wheel for scapy: filename=scapy-2.5.0-py2.py3-none-any.whl size=1444327 sha256=79596e5c07156a042ad265519c816427b1d8a154d83f4a10333aabdd9ca05fb6
  Stored in directory: /home/root/.cache/pip/wheels/82/b7/03/8344d8cf6695624746311bc0d389e9d05535ca83c35f90241d
Successfully built scapy
Installing collected packages: scapy
Successfully installed scapy-2.5.0
(desk) root@desk-mx6:~# pip3 install ujson
Collecting ujson
  Downloading ujson-5.10.0.tar.gz (7.2 MB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 7.2/7.2 MB 2.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: ujson
  Building wheel for ujson (pyproject. toml) ... done
  Created wheel for ujson: filename=ujson-5.10.0-cp310-cp310-linux_armv7l.whl size=43466 sha256=cc68245f2fed1acd639d72491faad894baa5956ba796e593a05af80aa99f9cc8
  Stored in directory: /home/root/.cache/pip/wheels/44/71/bf/0e6dd559ca520e54995e79f41d6ae7dcde6c1fce1f921a5811
Successfully built ujson
Installing collected packages: ujson
Successfully installed ujson-5.10.0
(desk) root@desk-mx6:~# pip3 install can
Collecting can
  Downloading can-0.0.0.tar.gz (1.0 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: can
  Building wheel for can (setup.py) ... done
  Created wheel for can: filename=can-0.0.0-py3-none-any.whl size=1266 sha256=98166a1099617ae1dcffcff0bbcabd7c68d7d45b94393b1277e9cd1e236deec8
  Stored in directory: /home/root/.cache/pip/wheels/ba/78/00/f80de555f7ba011d318f705b096a92efcad5151bc44cbfcb60
Successfully built can
Installing collected packages: can
Successfully installed can-0.0.0
(desk) root@desk-mx6:~# pip3 install cbor
Collecting cbor
  Downloading cbor-1.0.0.tar.gz (20 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: cbor
  Building wheel for cbor (setup.py) ... done
  Created wheel for cbor: filename=cbor-1.0.0-cp310-cp310-linux_armv7l.whl size=51603 sha256=6eee10db46d021f5ffb7580724b0694661863ba001924784d1ea6a7590622514
  Stored in directory: /home/root/.cache/pip/wheels/85/df/c9/b39e40eccaf76dbd218556639a6dc81562226f4c6a64902c85
Successfully built cbor
Installing collected packages: cbor
Successfully installed cbor-1.0.0
(desk) root@desk-mx6:~# pip3 install netifaces
Collecting netifaces
  Downloading netifaces-0.11.0.tar.gz (30 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: netifaces
  Building wheel for netifaces (setup.py) ... done
  Created wheel for netifaces: filename=netifaces-0.11.0-cp310-cp310-linux_armv7l.whl size=33988 sha256=c5b5301bd74e6a7f733a4a6a641b512c55f104a77e32b7dc68991cea722c5ec9
  Stored in directory: /home/root/.cache/pip/wheels/48/65/b3/4c4cc6038b81ff21cc9df69f2b6774f5f52e23d3c275ed15aa
Successfully built netifaces
Installing collected packages: netifaces
Successfully installed netifaces-0.11.0
(desk) root@desk-mx6:~# pip3 install python-prctl
Collecting python-prctl
  Downloading python-prctl-1.8.1.tar.gz (28 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: python-prctl
  Building wheel for python-prctl (setup.py) ... done
  Created wheel for python-prctl: filename=python_prctl-1.8.1-cp310-cp310-linux_armv7l.whl size=25267 sha256=b19635f967ea717eb393681f74eae25b12714c001d877a2ee871e43fe4d8f051
  Stored in directory: /home/root/.cache/pip/wheels/ba/64/4c/6358852ea13dc51f4b2a27d5a7ec5e8ff4dba377513dde3e5d
Successfully built python-prctl
Installing collected packages: python-prctl
Successfully installed python-prctl-1.8.1
(desk) root@desk-mx6:~#

rust[edit | edit source]

Some packages may require Rust compiler:

     Cargo, the Rust package manager, is not installed or is not on PATH.
     This package requires Rust and Cargo to compile extensions. Install it through
     the system's package manager or via https://rustup.rs/
  • download the rust Linux installer
wget https://sh.rustup.rs
mv index.html rustup-init.sh
chmod +x rustup-init.sh
  • execute the installer script:
./rustup-init.sh

Once installed the related environment should be initialized:

(desk) root@desk-mx6:~# . "$HOME/.cargo/env"

asyncua[edit | edit source]

  • now it is possible to install asyncua
(desk) root@desk-mx6:~# pip3 install asyncua
Collecting asyncua
  Downloading asyncua-1.1.0-py3-none-any.whl.metadata (9.3 kB)
Collecting aiofiles (from asyncua)
  Downloading aiofiles-23.2.1-py3-none-any.whl.metadata (9.7 kB)
Collecting aiosqlite (from asyncua)
  Downloading aiosqlite-0.20.0-py3-none-any.whl.metadata (4.3 kB)
Collecting python-dateutil (from asyncua)
  Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting pytz (from asyncua)
  Downloading pytz-2024.1-py2.py3-none-any.whl.metadata (22 kB)
Collecting cryptography>40.0.1 (from asyncua)
  Downloading cryptography-42.0.7.tar.gz (671 kB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 671.2/671.2 kB 2.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting sortedcontainers (from asyncua)
  Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl.metadata (10 kB)
Collecting pyOpenSSL (from asyncua)
  Downloading pyOpenSSL-24.1.0-py3-none-any.whl.metadata (12 kB)
Collecting typing-extensions (from asyncua)
  Using cached typing_extensions-4.12.1-py3-none-any.whl.metadata (3.0 kB)
Collecting cffi>=1.12 (from cryptography>40.0.1->asyncua)
  Using cached cffi-1.16.0-cp310-cp310-linux_armv7l.whl
Collecting six>=1.5 (from python-dateutil->asyncua)
  Downloading six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Collecting pycparser (from cffi>=1.12->cryptography>40.0.1->asyncua)
  Using cached pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
Downloading asyncua-1.1.0-py3-none-any.whl (773 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 773.7/773.7 kB 2.4 MB/s eta 0:00:00
Downloading aiofiles-23.2.1-py3-none-any.whl (15 kB)
Downloading aiosqlite-0.20.0-py3-none-any.whl (15 kB)
Using cached typing_extensions-4.12.1-py3-none-any.whl (37 kB)
Downloading pyOpenSSL-24.1.0-py3-none-any.whl (56 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 56.9/56.9 kB 572.1 kB/s eta 0:00:00
Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 229.9/229.9 kB 1.7 MB/s eta 0:00:00
Downloading pytz-2024.1-py2.py3-none-any.whl (505 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 505.5/505.5 kB 2.5 MB/s eta 0:00:00
Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB)
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Using cached pycparser-2.22-py3-none-any.whl (117 kB)
Building wheels for collected packages: cryptography
  Building wheel for cryptography (pyproject.toml) ... done
  Created wheel for cryptography: filename=cryptography-42.0.7-cp310-cp310-linux_armv7l.whl size=1385552 sha256=3b9a71a6eb7286c0f583baf231da8ab30358f71ebbe443512b433b40ee3e32e3
  Stored in directory: /home/root/.cache/pip/wheels/8a/43/81/6004292dd2de1e2263997a1e59331ae14d0c4ca5fcf8ca53bb
Successfully built cryptography
Installing collected packages: sortedcontainers, pytz, typing-extensions, six, pycparser, aiofiles, python-dateutil, cffi, aiosqlite, cryptography, pyOpenSSL, asyncua
Successfully installed aiofiles-23.2.1 aiosqlite-0.20.0 asyncua-1.1.0 cffi-1.16.0 cryptography-42.0.7 pyOpenSSL-24.1.0 pycparser-2.22 python-dateutil-2.9.0.post0 pytz-2024.1 six-1.16.0 sortedcontainers-2.4.0 typing-extensions-4.12.1
(desk) root@desk-mx6:~#

fastapi[edit | edit source]

  • in the same way it is possible to install fastapi
(desk) root@desk-mx6:~# pip3 install fastapi
Collecting fastapi
  Downloading fastapi-0.111.0-py3-none-any.whl.metadata (25 kB)
Collecting starlette<0.38.0,>=0.37.2 (from fastapi)
  Downloading starlette-0.37.2-py3-none-any.whl.metadata (5.9 kB)
Collecting pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4 (from fastapi)
  Downloading pydantic-2.7.3-py3-none-any.whl.metadata (108 kB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 109.0/109.0 kB 1.2 MB/s eta 0:00:00
Collecting typing-extensions>=4.8.0 (from fastapi)
  Downloading typing_extensions-4.12.1-py3-none-any.whl.metadata (3.0 kB)
Collecting fastapi-cli>=0.0.2 (from fastapi)
  Downloading fastapi_cli-0.0.4-py3-none-any.whl.metadata (7.0 kB)
Collecting httpx>=0.23.0 (from fastapi)
  Downloading httpx-0.27.0-py3-none-any.whl.metadata (7.2 kB)
Requirement already satisfied: jinja2>=2.11.2 in ./desk/lib/python3.10/site-packages (from fastapi) (3.1.4)
Collecting python-multipart>=0.0.7 (from fastapi)
  Downloading python_multipart-0.0.9-py3-none-any.whl.metadata (2.5 kB)
Requirement already satisfied: ujson!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,>=4.0.1 in ./desk/lib/python3.10/site-packages (from fastapi) (5.10.0)
Collecting orjson>=3.2.1 (from fastapi)
  Downloading orjson-3.10.3.tar.gz (4.9 MB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 4.9/4.9 MB 2.1 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting email_validator>=2.0.0 (from fastapi)
  Downloading email_validator-2.1.1-py3-none-any.whl.metadata (26 kB)
Collecting uvicorn>=0.12.0 (from uvicorn[standard]>=0.12.0->fastapi)
  Downloading uvicorn-0.30.1-py3-none-any.whl.metadata (6.3 kB)
Collecting dnspython>=2.0.0 (from email_validator>=2.0.0->fastapi)
  Downloading dnspython-2.6.1-py3-none-any.whl.metadata (5.8 kB)
Requirement already satisfied: idna>=2.0.0 in ./desk/lib/python3.10/site-packages (from email_validator>=2.0.0->fastapi) (3.7)
Collecting typer>=0.12.3 (from fastapi-cli>=0.0.2->fastapi)
  Downloading typer-0.12.3-py3-none-any.whl.metadata (15 kB)
Collecting anyio (from httpx>=0.23.0->fastapi)
  Downloading anyio-4.4.0-py3-none-any.whl.metadata (4.6 kB)
Requirement already satisfied: certifi in ./desk/lib/python3.10/site-packages (from httpx>=0.23.0->fastapi) (2024.6.2)
Collecting httpcore==1.* (from httpx>=0.23.0->fastapi)
  Downloading httpcore-1.0.5-py3-none-any.whl.metadata (20 kB)
Collecting sniffio (from httpx>=0.23.0->fastapi)
  Downloading sniffio-1.3.1-py3-none-any.whl.metadata (3.9 kB)
Collecting h11<0.15,>=0.13 (from httpcore==1.*->httpx>=0.23.0->fastapi)
  Downloading h11-0.14.0-py3-none-any.whl.metadata (8.2 kB)
Requirement already satisfied: MarkupSafe>=2.0 in ./desk/lib/python3.10/site-packages (from jinja2>=2.11.2->fastapi) (2.1.5)
Collecting annotated-types>=0.4.0 (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4->fastapi)
  Downloading annotated_types-0.7.0-py3-none-any.whl.metadata (15 kB)
Collecting pydantic-core==2.18.4 (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4->fastapi)
  Downloading pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.metadata (6.5 kB)
Requirement already satisfied: click>=7.0 in ./desk/lib/python3.10/site-packages (from uvicorn>=0.12.0->uvicorn[standard]>=0.12.0->fastapi) (8.1.7)
Collecting httptools>=0.5.0 (from uvicorn[standard]>=0.12.0->fastapi)
  Downloading httptools-0.6.1.tar.gz (191 kB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 191.2/191.2 kB 656.6 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting python-dotenv>=0.13 (from uvicorn[standard]>=0.12.0->fastapi)
  Downloading python_dotenv-1.0.1-py3-none-any.whl.metadata (23 kB)
Collecting pyyaml>=5.1 (from uvicorn[standard]>=0.12.0->fastapi)
  Downloading PyYAML-6.0.1.tar.gz (125 kB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 125.2/125.2 kB 780.4 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting uvloop!=0.15.0,!=0.15.1,>=0.14.0 (from uvicorn[standard]>=0.12.0->fastapi)
  Downloading uvloop-0.19.0.tar.gz (2.3 MB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 2.3/2.3 MB 1.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting watchfiles>=0.13 (from uvicorn[standard]>=0.12.0->fastapi)
  Using cached watchfiles-0.22.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.metadata (4.9 kB)
Collecting websockets>=10.4 (from uvicorn[standard]>=0.12.0->fastapi)
  Using cached websockets-12.0-py3-none-any.whl.metadata (6.6 kB)
Collecting exceptiongroup>=1.0.2 (from anyio->httpx>=0.23.0->fastapi)
  Using cached exceptiongroup-1.2.1-py3-none-any.whl.metadata (6.6 kB)
Collecting shellingham>=1.3.0 (from typer>=0.12.3->fastapi-cli>=0.0.2->fastapi)
  Using cached shellingham-1.5.4-py2.py3-none-any.whl.metadata (3.5 kB)
Collecting rich>=10.11.0 (from typer>=0.12.3->fastapi-cli>=0.0.2->fastapi)
  Using cached rich-13.7.1-py3-none-any.whl.metadata (18 kB)
Collecting markdown-it-py>=2.2.0 (from rich>=10.11.0->typer>=0.12.3->fastapi-cli>=0.0.2->fastapi)
  Using cached markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB)
Collecting pygments<3.0.0,>=2.13.0 (from rich>=10.11.0->typer>=0.12.3->fastapi-cli>=0.0.2->fastapi)
  Using cached pygments-2.18.0-py3-none-any.whl.metadata (2.5 kB)
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich>=10.11.0->typer>=0.12.3->fastapi-cli>=0.0.2->fastapi)
  Using cached mdurl-0.1.2-py3-none-any.whl.metadata (1.6 kB)
Downloading fastapi-0.111.0-py3-none-any.whl (91 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 92.0/92.0 kB 902.3 kB/s eta 0:00:00
Downloading email_validator-2.1.1-py3-none-any.whl (30 kB)
Downloading fastapi_cli-0.0.4-py3-none-any.whl (9.5 kB)
Downloading httpx-0.27.0-py3-none-any.whl (75 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 75.6/75.6 kB 767.8 kB/s eta 0:00:00
Downloading httpcore-1.0.5-py3-none-any.whl (77 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 77.9/77.9 kB 558.8 kB/s eta 0:00:00
Downloading pydantic-2.7.3-py3-none-any.whl (409 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 409.6/409.6 kB 1.4 MB/s eta 0:00:00
Downloading pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.8 MB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 1.8/1.8 MB 2.0 MB/s eta 0:00:00
Downloading python_multipart-0.0.9-py3-none-any.whl (22 kB)
Downloading starlette-0.37.2-py3-none-any.whl (71 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 71.9/71.9 kB 707.7 kB/s eta 0:00:00
Downloading typing_extensions-4.12.1-py3-none-any.whl (37 kB)
Downloading uvicorn-0.30.1-py3-none-any.whl (62 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 62.4/62.4 kB 655.0 kB/s eta 0:00:00
Downloading annotated_types-0.7.0-py3-none-any.whl (13 kB)
Downloading anyio-4.4.0-py3-none-any.whl (86 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 86.8/86.8 kB 933.8 kB/s eta 0:00:00
Downloading dnspython-2.6.1-py3-none-any.whl (307 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 307.7/307.7 kB 1.6 MB/s eta 0:00:00
Downloading h11-0.14.0-py3-none-any.whl (58 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 58.3/58.3 kB 600.7 kB/s eta 0:00:00
Downloading python_dotenv-1.0.1-py3-none-any.whl (19 kB)
Downloading sniffio-1.3.1-py3-none-any.whl (10 kB)
Downloading typer-0.12.3-py3-none-any.whl (47 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 47.2/47.2 kB 425.9 kB/s eta 0:00:00
Downloading watchfiles-0.22.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.2 MB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 1.2/1.2 MB 2.1 MB/s eta 0:00:00
Downloading websockets-12.0-py3-none-any.whl (118 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 118.4/118.4 kB 1.3 MB/s eta 0:00:00
Downloading exceptiongroup-1.2.1-py3-none-any.whl (16 kB)
Downloading rich-13.7.1-py3-none-any.whl (240 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 240.7/240.7 kB 1.5 MB/s eta 0:00:00
Downloading shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)
Downloading markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 87.5/87.5 kB 946.7 kB/s eta 0:00:00
Downloading pygments-2.18.0-py3-none-any.whl (1.2 MB)
   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 1.2/1.2 MB 2.4 MB/s eta 0:00:00
Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Building wheels for collected packages: orjson, httptools, pyyaml, uvloop
  Building wheel for orjson (pyproject.toml) ... done
  Created wheel for orjson: filename=orjson-3.10.3-cp310-cp310-linux_armv7l.whl size=339120 sha256=675ee3d6668ec07f5366623509c7bce08d9e0f8f2683014919fa03d0daee4d19
  Stored in directory: /home/root/.cache/pip/wheels/54/a6/29/5e3f7271026eddef9992371e173530fbd25ef2d222bc2c991e
  Building wheel for httptools (setup.py) ... done
  Created wheel for httptools: filename=httptools-0.6.1-cp310-cp310-linux_armv7l.whl size=323752 sha256=6ee16a26d63b91888d2ae09879fe1a1e29820f50bd1212a04175e6a3edd3df25
  Stored in directory: /home/root/.cache/pip/wheels/d4/94/74/b749f5d8a173eeaf18456fdfcfc6481eea5322bd2e1c3351ed
  Building wheel for pyyaml (pyproject.toml) ... done
  Created wheel for pyyaml: filename=PyYAML-6.0.1-cp310-cp310-linux_armv7l.whl size=45362 sha256=07766efd017e92864094687b491801d3a966633b0dd8759ea55b2947e1651707
Building wheels for collected packages: uvloop
  Building wheel for uvloop (pyproject.toml) ... done
  Created wheel for uvloop: filename=uvloop-0.19.0-cp310-cp310-linux_armv7l.whl size=3280613 sha256=d2316d5702ef50531d5c35b5541fcae6297a54447d758a88699c0daa86f25518
  Stored in directory: /home/root/.cache/pip/wheels/4b/9f/15/642387cf2d3288697a98357d4dd985d8747bf140747729dc81
Successfully built uvloop
Installing collected packages: websockets, uvloop, sniffio, shellingham, pyyaml, python-multipart, python-dotenv, pygments, pydantic-core, orjson, mdurl, httptools, h11, exceptiongroup, dnspython, annotated-types, uvicorn, pydantic, markdown-it-py, httpcore, email_validator, anyio, watchfiles, starlette, rich, httpx, typer, fastapi-cli, fastapi
Successfully installed annotated-types-0.7.0 anyio-4.4.0 dnspython-2.6.1 email_validator-2.1.1 exceptiongroup-1.2.1 fastapi-0.111.0 fastapi-cli-0.0.4 h11-0.14.0 httpcore-1.0.5 httptools-0.6.1 httpx-0.27.0 markdown-it-py-3.0.0 mdurl-0.1.2 orjson-3.10.3 pydantic-2.7.3 pydantic-core-2.18.4 pygments-2.18.0 python-dotenv-1.0.1 python-multipart-0.0.9 pyyaml-6.0.1 rich-13.7.1 shellingham-1.5.4 sniffio-1.3.1 starlette-0.37.2 typer-0.12.3 uvicorn-0.30.1 uvloop-0.19.0 watchfiles-0.22.0 websockets-12.0
(desk) root@desk-mx6:~#

check for installed packages and version[edit | edit source]

(desk) root@desk-mx6:~# pip3 list
Package            Version
------------------ -----------
aiofiles           23.2.1
aiosqlite          0.20.0
annotated-types    0.7.0
anyio              4.4.0
asyncua            1.1.0
blinker            1.8.2
bottle             0.12.25
can                0.0.0
cbor               1.0.0
certifi            2024.6.2
cffi               1.16.0
charset-normalizer 3.3.2
click              8.1.7
cryptography       42.0.7
dnspython          2.6.1
email_validator    2.1.1
exceptiongroup     1.2.1
fastapi            0.111.0
fastapi-cli        0.0.4
Flask              3.0.3
h11                0.14.0
httpcore           1.0.5
httptools          0.6.1
httpx              0.27.0
idna               3.7
itsdangerous       2.2.0
Jinja2             3.1.4
markdown-it-py     3.0.0
MarkupSafe         2.1.5
mdurl              0.1.2
netifaces          0.11.0
orjson             3.10.3
pip                24.0
pycparser          2.22
pydantic           2.7.3
pydantic_core      2.18.4
Pygments           2.18.0
pymodbus           3.6.8
pyOpenSSL          24.1.0
pyserial           3.5
python-dateutil    2.9.0.post0
python-dotenv      1.0.1
python-multipart   0.0.9
python-prctl       1.8.1
pytz               2024.1
PyYAML             6.0.1
requests           2.32.3
rich               13.7.1
scapy              2.5.0
schema             0.7.7
setuptools         70.0.0
shellingham        1.5.4
six                1.16.0
sniffio            1.3.1
sortedcontainers   2.4.0
ssdp               1.3.0
starlette          0.37.2
typer              0.12.3
typing_extensions  4.12.1
ujson              5.10.0
urllib3            2.2.1
uvicorn            0.30.1
uvloop             0.19.0
watchfiles         0.22.0
websockets         12.0
Werkzeug           3.0.3
wheel              0.43.0
(desk) root@desk-mx6:~#

import packages[edit | edit source]

Finally, after the installation steps, it is possible to import the packages:

(desk) root@desk-mx6:~# python3
Python 3.10.7 (main, Sep  5 2022, 13:12:31) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(desk) root@desk-mx6:~# python3
Python 3.10.7 (main, Sep  5 2022, 13:12:31) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import sys
>>> import os
>>> import time
>>> import ssl
>>> import bottle
>>> import can
>>> import cbor
>>> import flask
>>> import netifaces
>>> import pymodbus
>>> import prctl
>>> import requests
>>> import scapy
>>> import schema
>>> import serial
>>> import ssdp
>>> import ujson
>>>

Accessing gpio via gpiod python package[edit | edit source]

As a usage example, it is possible to access a GPIO via libgpiod character device gpio interface. The gpiod project is the official Python bindings for libgpiod.

Please refer to this Application Nore for more information about the hardware adapter useful for this example.

First of all, install the python package in the virtual-env:

(desk-env) root@desk-mx6:~# pip3 install gpiod
Collecting gpiod
  Downloading gpiod-2.1.3.tar.gz (53 kB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 53.1/53.1 kB 331.5 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: gpiod
  Building wheel for gpiod (pyproject.toml) ... done
  Created wheel for gpiod: filename=gpiod-2.1.3-cp310-cp310-linux_armv7l.whl size=96152 sha256=a56d180489250b212d13e147a72dd6cf8f4f2fd8ec66c66957ac241314003ce8
  Stored in directory: /home/root/.cache/pip/wheels/15/1a/71/ccf4d410494a29e084aa1ed010e7d7ca33eebe0200e634c3b9
Successfully built gpiod
Installing collected packages: gpiod
Successfully installed gpiod-2.1.3
(desk-env) root@desk-mx6:~#

As per the device tree code example:

  MX6QDL_PAD_EIM_D21__GPIO3_IO21  0x1b0b1         /* LED0 - gpio85        */
  MX6QDL_PAD_EIM_D22__GPIO3_IO22  0x1b0b1         /* LED1 - gpio86        */
  MX6QDL_PAD_EIM_D28__GPIO3_IO28  0x1b0b1         /* LED2 - gpio92        */
  MX6QDL_PAD_EIM_D20__GPIO3_IO20  0x1b0b1         /* LED3 - gpio84        */

it is possible to see which gpio number is associated to the LEDs.

As seen by the kernel gpio interface:

root@desk-mx6:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/209c000.gpio, 209c000.gpio:
 gpio-0   (                    |power-seq-gpio1     ) out hi
 gpio-4   (                    |reset               ) out hi ACTIVE LOW
 gpio-24  (                    |regulators:usb_otg_v) out lo

gpiochip1: GPIOs 32-63, parent: platform/20a0000.gpio, 20a0000.gpio:
 gpio-62  (                    |spi0 CS0            ) out hi ACTIVE LOW

gpiochip2: GPIOs 64-95, parent: platform/20a4000.gpio, 20a4000.gpio:
 gpio-83  (                    |cd                  ) in  lo IRQ ACTIVE LOW
 gpio-93  (                    |5-0048              ) in  hi IRQ ACTIVE LOW
 gpio-95  (                    |regulators:usb_h1_vb) out hi
...
...

the LED belongs to the gpiochip2 device (from number 64 to 95).

In this way, it is possible to create a Python code gpiod-example.py which toggle/blink a LED:

import gpiod
import time

from gpiod.line import Direction, Value

LINE = 22

print("LED blink example")

with gpiod.request_lines(
    "/dev/gpiochip2",
    consumer="blink-example",
    config={
        LINE: gpiod.LineSettings(
            direction=Direction.OUTPUT, output_value=Value.ACTIVE
        )
    },
) as request:
    while True:
        request.set_value(LINE, Value.ACTIVE)
        time.sleep(1)
        request.set_value(LINE, Value.INACTIVE)
        time.sleep(1)

In this example, LINE = 22 means gpiochip2 line 22 => 64+22 = gpio86 (i.e. LED1)

(desk-env) root@desk-mx6:~# python3 gpiod-example.py
LED blink example