DESK-MX6UL-AN-0004: Using Python for Embedded applications

From DAVE Developer's Wiki
Revision as of 15:50, 6 October 2021 by U0007 (talk | contribs) (easy install)

Jump to: navigation, search


200px-Emblem-important.svg.png

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

History[edit | edit source]

Version Date Development Kit version
1.0.0 Oct 2021 DESK-MX6UL-L 1.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 adding python3 libraries to the SBC Lynx platform.

Python on DESK[edit | edit source]

python and python3 applications are already present on DESK-MX6UL-L dave-image-devel root file system.

Moreover, a huge list of python packages can be installed in the target using the DNF package manager: the DESK-MX6UL-AN-0003 shows how to install rpm packages in the target from the DAVE's Yocto repository server.

Installing python packages[edit | edit source]

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

root@desk-mx6ul-axelulite:~# python3 --version
Python 3.5.5
root@desk-mx6ul-axelulite:~# pip --version
pip 9.0.3 from /usr/lib/python2.7/site-packages (python 2.7)
root@desk-mx6ul-axelulite:~# easy3_install --version
setuptools 39.0.0 from /usr/lib/python3.5/site-packages (Python 3.5)
root@desk-mx6ul-axelulite:~#

Due to older pip version, it is worth to update pip before proceeding:

root@desk-mx6ul-axelulite:~# python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/27/79/8a850fe3496446ff0d584327ae44e7500daf6764ca1a382d2d02789accf7/pip-20.3.4-py2.py3-none-any.whl (1.5MB)
    100% |################################| 1.5MB 52kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-20.3.4
You are using pip version 20.3.4, however version 21.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
root@desk-mx6ul-axelulite:~# pip --version
pip 20.3.4 from /usr/lib/python2.7/site-packages/pip (python 2.7)
root@desk-mx6ul-axelulite:~#

easy install[edit | edit source]

Even if easy_install tool has been deprecated, it is a useful tool still present in the typical python distributions.

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

In this example, the following packages are installed using easy3_install (easy_install version for python3): pyserial and pymodbus (for bus communications), requests (HTTP library), schema, ssdp:

root@desk-mx6ul-axelulite:~# easy3_install pyserial
Searching for pyserial
Best match: pyserial 3.4
Adding pyserial 3.4 to easy-install.pth file

Using /usr/lib/python3.5/site-packages
Processing dependencies for pyserial
Finished processing dependencies for pyserial
root@desk-mx6ul-axelulite:~# easy3_install pymodbus
Searching for pymodbus
Reading https://pypi.python.org/simple/pymodbus/
Downloading https://files.pythonhosted.org/packages/57/21/6c9b1cade55161444450bdde6e953edb819d984beafee8d4baefa4f0310c/pymodbus-2.5.3rc1-py2.py3-none-any.whl#sha256=e8cbf3594a8dd0f71c287e24d8365e69836c8d22cac5ab288110638fd2b9fda6
Best match: pymodbus 2.5.3rc1
Processing pymodbus-2.5.3rc1-py2.py3-none-any.whl
Installing pymodbus-2.5.3rc1-py2.py3-none-any.whl to /usr/lib/python3.5/site-packages
writing requirements to /usr/lib/python3.5/site-packages/pymodbus-2.5.3rc1-py3.5.egg/EGG-INFO/requires.txt
Adding pymodbus 2.5.3rc1 to easy-install.pth file
Installing pymodbus.server script to /usr/bin
Installing pymodbus.console script to /usr/bin

Installed /usr/lib/python3.5/site-packages/pymodbus-2.5.3rc1-py3.5.egg
Processing dependencies for pymodbus
Searching for six>=1.15.0
Reading https://pypi.python.org/simple/six/
Downloading https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl#sha256=8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254
Best match: six 1.16.0
Processing six-1.16.0-py2.py3-none-any.whl
Installing six-1.16.0-py2.py3-none-any.whl to /usr/lib/python3.5/site-packages
Adding six 1.16.0 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/six-1.16.0-py3.5.egg
Finished processing dependencies for pymodbus
root@desk-mx6ul-axelulite:~# easy3_install requests
Searching for requests
Reading https://pypi.python.org/simple/requests/
Downloading https://files.pythonhosted.org/packages/92/96/144f70b972a9c0eabbd4391ef93ccd49d0f2747f4f6a2a2738e99e5adc65/requests-2.26.0-py2.py3-none-any.whl#sha256=6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24
Best match: requests 2.26.0
Processing requests-2.26.0-py2.py3-none-any.whl
Installing requests-2.26.0-py2.py3-none-any.whl to /usr/lib/python3.5/site-packages
writing requirements to /usr/lib/python3.5/site-packages/requests-2.26.0-py3.5.egg/EGG-INFO/requires.txt
Adding requests 2.26.0 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/requests-2.26.0-py3.5.egg
Processing dependencies for requests
Searching for urllib3<1.27,>=1.21.1
Reading https://pypi.python.org/simple/urllib3/
Downloading https://files.pythonhosted.org/packages/af/f4/524415c0744552cce7d8bf3669af78e8a069514405ea4fcbd0cc44733744/urllib3-1.26.7-py2.py3-none-any.whl#sha256=c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844
Best match: urllib3 1.26.7
Processing urllib3-1.26.7-py2.py3-none-any.whl
Installing urllib3-1.26.7-py2.py3-none-any.whl to /usr/lib/python3.5/site-packages
writing requirements to /usr/lib/python3.5/site-packages/urllib3-1.26.7-py3.5.egg/EGG-INFO/requires.txt
Adding urllib3 1.26.7 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/urllib3-1.26.7-py3.5.egg
Searching for charset-normalizer~=2.0.0
Reading https://pypi.python.org/simple/charset-normalizer/
Downloading https://files.pythonhosted.org/packages/3f/65/69e6754102dcd018a0f29e4db673372eb323ee504431125ab6c9109cb21c/charset_normalizer-2.0.6-py3-none-any.whl#sha256=5d209c0a931f215cee683b6445e2d77677e7e75e159f78def0db09d68fafcaa6
Best match: charset-normalizer 2.0.6
Processing charset_normalizer-2.0.6-py3-none-any.whl
Installing charset_normalizer-2.0.6-py3-none-any.whl to /usr/lib/python3.5/site-packages
writing requirements to /usr/lib/python3.5/site-packages/charset_normalizer-2.0.6-py3.5.egg/EGG-INFO/requires.txt
Adding charset-normalizer 2.0.6 to easy-install.pth file
Installing normalizer script to /usr/bin

Installed /usr/lib/python3.5/site-packages/charset_normalizer-2.0.6-py3.5.egg
Searching for certifi>=2017.4.17
Reading https://pypi.python.org/simple/certifi/
Downloading https://files.pythonhosted.org/packages/05/1b/0a0dece0e8aa492a6ec9e4ad2fe366b511558cdc73fd3abc82ba7348e875/certifi-2021.5.30-py2.py3-none-any.whl#sha256=50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8
Best match: certifi 2021.5.30
Processing certifi-2021.5.30-py2.py3-none-any.whl
Installing certifi-2021.5.30-py2.py3-none-any.whl to /usr/lib/python3.5/site-packages
Adding certifi 2021.5.30 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/certifi-2021.5.30-py3.5.egg
Finished processing dependencies for requests
root@desk-mx6ul-axelulite:~# easy3_install schema
Searching for schema
Reading https://pypi.python.org/simple/schema/
Downloading https://files.pythonhosted.org/packages/c7/64/497632c9dc3c1bc94a92d9cafdc5cbd21d011bb651952765195739129a49/schema-0.7.4-py2.py3-none-any.whl#sha256=cf97e4cd27e203ab6bb35968532de1ed8991bce542a646f0ff1d643629a4945d
Best match: schema 0.7.4
Processing schema-0.7.4-py2.py3-none-any.whl
Installing schema-0.7.4-py2.py3-none-any.whl to /usr/lib/python3.5/site-packages
writing requirements to /usr/lib/python3.5/site-packages/schema-0.7.4-py3.5.egg/EGG-INFO/requires.txt
Adding schema 0.7.4 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/schema-0.7.4-py3.5.egg
Processing dependencies for schema
Searching for contextlib2>=0.5.5
Reading https://pypi.python.org/simple/contextlib2/
Downloading https://files.pythonhosted.org/packages/76/56/6d6872f79d14c0cb02f1646cbb4592eef935857c0951a105874b7b62a0c3/contextlib2-21.6.0-py2.py3-none-any.whl#sha256=3fbdb64466afd23abaf6c977627b75b6139a5a3e8ce38405c5b413aed7a0471f
Best match: contextlib2 21.6.0
Processing contextlib2-21.6.0-py2.py3-none-any.whl
Installing contextlib2-21.6.0-py2.py3-none-any.whl to /usr/lib/python3.5/site-packages
Adding contextlib2 21.6.0 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/contextlib2-21.6.0-py3.5.egg
Finished processing dependencies for schema
root@desk-mx6ul-axelulite:~# easy3_install ssdp
Searching for ssdp
Reading https://pypi.python.org/simple/ssdp/
Downloading https://files.pythonhosted.org/packages/1d/04/d761ea63c8cb9e0e8a37cc63df9ec39c8c6a0f77363d131035b694758a5d/ssdp-1.1.0-py2.py3-none-any.whl#sha256=dc91a844e54ba6b1a2f3be4d9a52302027f71719c5eb2c0e6fbd77e67e7343ad
Best match: ssdp 1.1.0
Processing ssdp-1.1.0-py2.py3-none-any.whl
Installing ssdp-1.1.0-py2.py3-none-any.whl to /usr/lib/python3.5/site-packages
Adding ssdp 1.1.0 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/ssdp-1.1.0-py3.5.egg
Processing dependencies for ssdp
Finished processing dependencies for ssdp
root@desk-mx6ul-axelulite:~#

Then, add some useful IP packages like nmap or scapy (network packet manipulation):

root@desk-mx6ul-axelulite:~# easy3_install nmap
Searching for nmap
Reading https://pypi.python.org/simple/nmap/
Downloading https://files.pythonhosted.org/packages/f8/6f/6813025bd575ebc771189afaab7c405fdf3f1febaa197525d5aa6fd88ac5/nmap-0.0.1-py3-none-any.whl#sha256=158de16af02043e1a2015662ad1710dfb46dadd2bea8e9d90ba16b78b6650098
Best match: nmap 0.0.1
Processing nmap-0.0.1-py3-none-any.whl
Installing nmap-0.0.1-py3-none-any.whl to /usr/lib/python3.5/site-packages
Adding nmap 0.0.1 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/nmap-0.0.1-py3.5.egg
Processing dependencies for nmap
Finished processing dependencies for nmap
root@desk-mx6ul-axelulite:~# easy3_install scapy
Searching for scapy
Reading https://pypi.python.org/simple/scapy/
Downloading https://files.pythonhosted.org/packages/85/47/c919432ca258f354bb2c1e645623f891603f185bfc7563d4a21f6432e7ed/scapy-2.4.5.tar.gz#sha256=bc707e3604784496b6665a9e5b2a69c36cc9fb032af4864b29051531b24c8593
Best match: scapy 2.4.5
Processing scapy-2.4.5.tar.gz
Writing /tmp/easy_install-vsqq0ans/scapy-2.4.5/setup.cfg
Running scapy-2.4.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-vsqq0ans/scapy-2.4.5/egg-dist-tmp-nauxdhas
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
creating /usr/lib/python3.5/site-packages/scapy-2.4.5-py3.5.egg
Extracting scapy-2.4.5-py3.5.egg to /usr/lib/python3.5/site-packages
Adding scapy 2.4.5 to easy-install.pth file
Installing scapy script to /usr/bin
Installing UTscapy script to /usr/bin

Installed /usr/lib/python3.5/site-packages/scapy-2.4.5-py3.5.egg
Processing dependencies for scapy
Finished processing dependencies for scapy
root@desk-mx6ul-axelulite:~#

On top of that, some web packages are very useful for creating web application and remotely control/get information from the gateway: bottle (lightweight WSGI micro web-framework), fastapi (high-performance web framework):

root@desk-mx6ul-axelulite:~# easy3_install bottle
Searching for bottle
Reading https://pypi.python.org/simple/bottle/
Downloading https://files.pythonhosted.org/packages/bf/44/aeafdd6ca05a8e1c3f91eeeb272a202d5cb1b3b23730a5ca686a81c48d24/bottle-0.12.19-py3-none-any.whl#sha256=f6b8a34fe9aa406f9813c02990db72ca69ce6a158b5b156d2c41f345016a723d
Best match: bottle 0.12.19
Processing bottle-0.12.19-py3-none-any.whl
Installing bottle-0.12.19-py3-none-any.whl to /usr/lib/python3.5/site-packages
Adding bottle 0.12.19 to easy-install.pth file
Installing bottle.py script to /usr/bin

Installed /usr/lib/python3.5/site-packages/bottle-0.12.19-py3.5.egg
Processing dependencies for bottle
Finished processing dependencies for bottle
root@desk-mx6ul-axelulite:~# easy3_install fastapi
Searching for fastapi
Reading https://pypi.python.org/simple/fastapi/
Downloading https://files.pythonhosted.org/packages/92/a8/10d8a171afa66e6e8a5cfe82771d11c4c84a2a874c19c0b55c7099001fac/fastapi-0.68.2-py3-none-any.whl#sha256=36bcdd3dbea87c586061005e4a40b9bd0145afd766655b4e0ec1d8870b32555c
Best match: fastapi 0.68.2
Processing fastapi-0.68.2-py3-none-any.whl
Installing fastapi-0.68.2-py3-none-any.whl to /usr/lib/python3.5/site-packages
writing requirements to /usr/lib/python3.5/site-packages/fastapi-0.68.2-py3.5.egg/EGG-INFO/requires.txt
Adding fastapi 0.68.2 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/fastapi-0.68.2-py3.5.egg
Processing dependencies for fastapi
Searching for starlette==0.14.2
Reading https://pypi.python.org/simple/starlette/
Downloading https://files.pythonhosted.org/packages/15/34/db1890f442a1cd3a2c761f4109a0eb4e63503218d70a8c8e97faa09a5500/starlette-0.14.2-py3-none-any.whl#sha256=3c8e48e52736b3161e34c9f0e8153b4f32ec5d8995a3ee1d59410d92f75162ed
Best match: starlette 0.14.2
Processing starlette-0.14.2-py3-none-any.whl
Installing starlette-0.14.2-py3-none-any.whl to /usr/lib/python3.5/site-packages
writing requirements to /usr/lib/python3.5/site-packages/starlette-0.14.2-py3.5.egg/EGG-INFO/requires.txt
Adding starlette 0.14.2 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/starlette-0.14.2-py3.5.egg
Searching for pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2
Reading https://pypi.python.org/simple/pydantic/
Downloading https://files.pythonhosted.org/packages/ff/74/54e030641601112309f6d2af620774e9080f99c7a15742fc6a0b170c4076/pydantic-1.8.2-py3-none-any.whl#sha256=fec866a0b59f372b7e776f2d7308511784dace622e0992a0b59ea3ccee0ae833
Best match: pydantic 1.8.2
Processing pydantic-1.8.2-py3-none-any.whl
Installing pydantic-1.8.2-py3-none-any.whl to /usr/lib/python3.5/site-packages
writing requirements to /usr/lib/python3.5/site-packages/pydantic-1.8.2-py3.5.egg/EGG-INFO/requires.txt
Adding pydantic 1.8.2 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/pydantic-1.8.2-py3.5.egg
Searching for typing-extensions>=3.7.4.3
Reading https://pypi.python.org/simple/typing-extensions/
Downloading https://files.pythonhosted.org/packages/74/60/18783336cc7fcdd95dae91d73477830aa53f5d3181ae4fe20491d7fc3199/typing_extensions-3.10.0.2-py3-none-any.whl#sha256=f1d25edafde516b146ecd0613dabcc61409817af4766fbbcfb8d1ad4ec441a34
Best match: typing-extensions 3.10.0.2
Processing typing_extensions-3.10.0.2-py3-none-any.whl
Installing typing_extensions-3.10.0.2-py3-none-any.whl to /usr/lib/python3.5/site-packages
Adding typing-extensions 3.10.0.2 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/typing_extensions-3.10.0.2-py3.5.egg
Finished processing dependencies for fastapi

and finally an MQTT client like Eclipse paho MQTT is installed too:

root@desk-mx6ul-axelulite:~# easy3_install paho-mqtt
Searching for paho-mqtt
Reading https://pypi.python.org/simple/paho-mqtt/
Downloading https://files.pythonhosted.org/packages/32/d3/6dcb8fd14746fcde6a556f932b5de8bea8fedcb85b3a092e0e986372c0e7/paho-mqtt-1.5.1.tar.gz#sha256=9feb068e822be7b3a116324e01fb6028eb1d66412bf98595ae72698965cb1cae
Best match: paho-mqtt 1.5.1
Processing paho-mqtt-1.5.1.tar.gz
Writing /tmp/easy_install-vkarrpqi/paho-mqtt-1.5.1/setup.cfg
Running paho-mqtt-1.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-vkarrpqi/paho-mqtt-1.5.1/egg-dist-tmp-tt8lku70
creating /usr/lib/python3.5/site-packages/paho_mqtt-1.5.1-py3.5.egg
Extracting paho_mqtt-1.5.1-py3.5.egg to /usr/lib/python3.5/site-packages
Adding paho-mqtt 1.5.1 to easy-install.pth file

Installed /usr/lib/python3.5/site-packages/paho_mqtt-1.5.1-py3.5.egg
Processing dependencies for paho-mqtt
Finished processing dependencies for paho-mqtt
root@desk-mx6ul-axelulite:~#

DNF[edit | edit source]

In case of some troubles (which can happens using easy_install or pip), other packages can be directly installed using dnf from the already built rpm packages built with Yocto:

For example, for installing flask or ujson it is possible to use dnf install <rpm-package>:

root@desk-mx6ul-axelulite:~# dnf install python3-flask
Last metadata expiration check: 0:13:01 ago on Wed Oct  6 08:39:56 2021.
Dependencies resolved.
================================================================================
 Package                   Arch               Version       Repository     Size
================================================================================
Installing:
 python3-flask             cortexa7hf_neon    0.12.2-r0     cortexa7hf    110 k
Installing dependencies:
 python3-click             cortexa7hf_neon    6.7-r0        cortexa7hf    110 k
 python3-itsdangerous      cortexa7hf_neon    0.24-r0       cortexa7hf     23 k
 python3-jinja2            cortexa7hf_neon    2.10-r0       cortexa7hf    187 k
 python3-markupsafe        cortexa7hf_neon    1.0-r0        cortexa7hf     25 k
 python3-simplejson        cortexa7hf_neon    3.13.2-r0     cortexa7hf     50 k
 python3-werkzeug          cortexa7hf_neon    0.14.1-r0     cortexa7hf    375 k
 python3-werkzeug-tests    cortexa7hf_neon    0.14.1-r0     cortexa7hf     32 k

Transaction Summary
================================================================================
Install  8 Packages

Total download size: 912 k
Installed size: 3.7 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): python3-itsdangerous-0.24-r0.cortexa7hf_ 128 kB/s |  23 kB     00:00
(2/8): python3-flask-0.12.2-r0.cortexa7hf_neon. 344 kB/s | 110 kB     00:00
(3/8): python3-click-6.7-r0.cortexa7hf_neon.rpm 329 kB/s | 110 kB     00:00
(4/8): python3-jinja2-2.10-r0.cortexa7hf_neon.r 508 kB/s | 187 kB     00:00
(5/8): python3-werkzeug-tests-0.14.1-r0.cortexa 137 kB/s |  32 kB     00:00
(6/8): python3-markupsafe-1.0-r0.cortexa7hf_neo 318 kB/s |  25 kB     00:00
(7/8): python3-simplejson-3.13.2-r0.cortexa7hf_ 220 kB/s |  50 kB     00:00
(8/8): python3-werkzeug-0.14.1-r0.cortexa7hf_ne 684 kB/s | 375 kB     00:00
--------------------------------------------------------------------------------
Total                                           979 kB/s | 912 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : python3-werkzeug-0.14.1-r0.cortexa7hf_neon             1/8
  Installing       : python3-werkzeug-tests-0.14.1-r0.cortexa7hf_neon       2/8
  Installing       : python3-markupsafe-1.0-r0.cortexa7hf_neon              3/8
  Installing       : python3-jinja2-2.10-r0.cortexa7hf_neon                 4/8
  Installing       : python3-simplejson-3.13.2-r0.cortexa7hf_neon           5/8
  Installing       : python3-itsdangerous-0.24-r0.cortexa7hf_neon           6/8
  Installing       : python3-click-6.7-r0.cortexa7hf_neon                   7/8
  Installing       : python3-flask-0.12.2-r0.cortexa7hf_neon                8/8
  Verifying        : python3-flask-0.12.2-r0.cortexa7hf_neon                1/8
  Verifying        : python3-click-6.7-r0.cortexa7hf_neon                   2/8
  Verifying        : python3-itsdangerous-0.24-r0.cortexa7hf_neon           3/8
  Verifying        : python3-jinja2-2.10-r0.cortexa7hf_neon                 4/8
  Verifying        : python3-werkzeug-0.14.1-r0.cortexa7hf_neon             5/8
  Verifying        : python3-werkzeug-tests-0.14.1-r0.cortexa7hf_neon       6/8
  Verifying        : python3-simplejson-3.13.2-r0.cortexa7hf_neon           7/8
  Verifying        : python3-markupsafe-1.0-r0.cortexa7hf_neon              8/8

Installed:
  python3-flask.cortexa7hf_neon 0.12.2-r0
  python3-click.cortexa7hf_neon 6.7-r0
  python3-itsdangerous.cortexa7hf_neon 0.24-r0
  python3-jinja2.cortexa7hf_neon 2.10-r0
  python3-markupsafe.cortexa7hf_neon 1.0-r0
  python3-simplejson.cortexa7hf_neon 3.13.2-r0
  python3-werkzeug.cortexa7hf_neon 0.14.1-r0
  python3-werkzeug-tests.cortexa7hf_neon 0.14.1-r0

Complete!
root@desk-mx6ul-axelulite:~# dnf install python3-ujson
Last metadata expiration check: 1:31:56 ago on Wed Oct  6 08:39:56 2021.
Dependencies resolved.
================================================================================
 Package             Arch                  Version       Repository        Size
================================================================================
Installing:
 python3-ujson       cortexa7hf_neon       1.35-r0       cortexa7hf        24 k

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

Total download size: 24 k
Installed size: 59 k
Is this ok [y/N]: y
Downloading Packages:
python3-ujson-1.35-r0.cortexa7hf_neon.rpm        22 kB/s |  24 kB     00:01
--------------------------------------------------------------------------------
Total                                            21 kB/s |  24 kB     00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : python3-ujson-1.35-r0.cortexa7hf_neon                  1/1
  Verifying        : python3-ujson-1.35-r0.cortexa7hf_neon                  1/1

Installed:
  python3-ujson.cortexa7hf_neon 1.35-r0

Complete!
root@desk-mx6ul-axelulite:~#

As you can see, dnf automatically manage the dependencies: for example, flask procedure install also 'Jinja2, Markupsafe, simplejson, Werkzeug.

import packages[edit | edit source]

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

root@desk-mx6ul-axelulite:~# python3
Python 3.5.5 (default, Jul 16 2020, 16:11:13)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import os
>>> import time
>>> import supervisor
>>> import ssl
>>> import nmap
>>> import scapy
>>> import serial
>>> import pymodbus
>>> import schema
>>> import ssdp
>>> import requests
>>> import flask
>>> import bottle
>>> import ujson
>>> import paho
>>>