<code>python3</code> application is already present on [[DESK-XZ7-L/Development/Building_the_Yocto_BSP#Quick_reference Creating_and_building_the_Petalinux_project | DESK-XZ7-L]] <code>petalinux</code> root file system.
== Installing python packages ==
</pre>
<code>pip3</code> version can be upgraded tooinstalled using python and the related script [https://pip.pypa.io/en/stable/installation/#get-pip-py <code>get-pip-py</code>]:
<pre class="board-terminal">
root@bora:~# pip3 wget https://bootstrap.pypa.io/get-pip.pyConnecting to bootstrap.pypa.io (151.101.0.175:443)wget: note: TLS certificate validation not implementedsaving to 'get-versionpip.py'get-pip 20.py 100% |********************************************************************************************| 2573k 0.2 from /usr/lib/python3.8/site:00:00 ETA'get-packages/pip (python 3.8)py' savedroot@bora:~# pip3 install python3 get--upgrade pip.py
Collecting pip
Downloading pip-2223.3.2-py3-none-any.whl.metadata (3.5 kB)Collecting setuptools Downloading setuptools-69.0.3-py3-none-any.whl.metadata (6.3 kB)Collecting wheel Downloading wheel-0.42.0-py3-none-any.whl.metadata (2.2 kB)Downloading pip-23.3.2-py3-none-any.whl (2.1 MB) |████████████████████████████████| ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 2.1 MB 289 /s eta 0:00:00Downloading setuptools-69.0.3-py3-none-any.whl (819 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 819.5/819.5 kB 1.9 MB/s eta 0:00:00Downloading wheel-0.42.0-py3-none-any.whl (65 kB)Installing collected packages ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.4/65.4 kB 427.3 kB/s eta 0: pip Attempting uninstall00: pip00 Found existing installationDEPRECATION: pip 20gpg 1.14.0-unknown has a non-standard version number.2 Uninstalling pip-2024.0will enforce this behaviour change. A possible replacement is to upgrade to a newer version of gpg or contact the author to suggest that they release a version with a conforming version number. Discussion can be found at https://github.2com/pypa/pip/issues/12063Installing collected packages:wheel, setuptools, pipSuccessfully uninstalled installed pip-2023.3.2 setuptools-69.0.3 wheel-0.242.0Successfully installed WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip-22.3pypa.io/warnings/venv
root@bora:~#
</pre>
* then, pip version can be checked
<pre class="board-terminal">
root@bora:~# pip3 --version
pip 23.3.2 from /usr/lib/python3.8/site-packages/pip (python 3.8)
Downloading virtualenv-20.1625.50-py3-none-any.whl .metadata (84.5 kB)Collecting distlib<1,>=0.3.8 MB7 (from virtualenv) |████████████████████████████████| Downloading distlib-0.3.8-py2.8/8py3-none-any.8 MB 2whl.metadata (5 MB/s eta 0:00:00.1 kB)Collecting filelock<4,>=3.412.12 (from virtualenv) Downloading filelock-3.813.01-py3-none-any.whl .metadata (10 2.8 kB)Collecting distlibplatformdirs<15,>=3.9.1 (from virtualenv) Downloading platformdirs-4.1.0-py3-none-any.whl.metadata (11 kB)Downloading virtualenv-20.25.0-py3-none-any.whl (3.8 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.58 MB 1.9 MB/s eta 0:00:00Downloading distlib-0.3.68-py2.py3-none-any.whl (468 kB) |████████████████████████████████| ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.59/468.5 9 kB 2.2 MB/s eta 0:00:00Collecting platformdirs<Downloading filelock-3,>=2.413.1-py3-none-any.whl (11 kB)Downloading platformdirs-24.51.20-py3-none-any.whl (14 17 kB)DEPRECATION: gpg 1.14.0-unknown has a non-standard version number. pip 24.0 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of gpg or contact the author to suggest that they release a version with a conforming version number. Discussion can be found at https://github.com/pypa/pip/issues/12063
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@bora:~#
</pre>
then * the <code>virtual environment</code> named '''desk''' can be created:
* '''python-prctl''' (C extension for system call)
* '''requests''' (Python HTTP)
<pre class="board-terminal">
(desk) root@bora:~# pip3 install netifaces
Collecting netifaces
Using cached 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-cp38-cp38-linux_armv7l.whl size=35205 sha256=e405dea3379d15e715be65b57f651beef13df5df815013bb8332960a481f58ac
Stored in directory: /home/root/.cache/pip/wheels/04/e2/b4/b811799a082cacaeff801af32c856fbefe6279ba96554d9a21
Successfully built netifaces
Installing collected packages: netifaces
Successfully installed netifaces-0.11.0
(desk) root@bora:~# 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=b210b09ceb4ddf6c322bd2b7b249976cd45312b0919b7044158698ca604d9a00
Stored in directory: /home/root/.cache/pip/wheels/45/b4/e7/1f023b01e25425d5b9f3d2d537af7d7bf632e5d7a66ee703ed
Successfully built can
Installing collected packages: can
Successfully installed can-0.0.0
(desk) root@bora:~# 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-cp38py3-cp38none-linux_armv7lany.whl size=51722 10029 sha256=056a9213e339003ff735d05fec04fa008ce05284211db1bc8c38083efb20013d36179cc461113f665dd3e948c56e5928726b83f01efc6107fe08030bf49ed8b2 Stored in directory: /home/root/.cache/pip/wheels/6231/393a/af8a/70e4f2f1154ae74c7689a115210902b4adcf8967f94253f8789d1a5e6f83f620826578089812b8ac236b86eaf4fbc3b36384
root@bora:~# ./rustup-init.shinfo: downloading installerWarning: using the BusyBox version of wget. Not enforcing strong cipher suites for TLS or TLS v1.2, this is potentially less secureConnecting to static.rust-lang.org (99.86.159.71:443)wget: note: TLS certificate validation not implementedsaving to '/tmp/tmp.crML5188Vt/rustup-init'rustup-init 100% |********************************| 13.5M 0:00:00 ETA'/tmp/tmp.crML5188Vt/rustup-init' saved$<2>Welcome to Rust!$<2>This will download and install the official compiler for the Rustprogramming language, and its package manager, Cargo.......$<2>Rust is installed now. Great!$<2>To get started you may need to restart your current shell.This would reload your $<2>PATH$<2> environment variable to includeCargo's bin directory ($HOME/.cargo/bin).To configure your current shell, run:source "$HOME/.cargo/env"
root@bora:~#
</pre>
Once installed the related environment should be initialized:
and again the ''Virtual environment'' activated For building <code>wheel</code> some package are required (for installing the package inside the envlike <code>python3-dev</code>)and this can be installed using <code>dnf</code>:
<pre class="board-terminal">
root@bora:~# source envdnf install python3-devOE Remote Repo: sswreleases rel-v2021.2 generic 1.4 kB/bins | 257 B 00:00OE Remote Repo: sswreleases rel-v2021.2 generic 3.7 kB/activates | 257 B 00:00OE Remote Repo: sswreleases rel-v2021.2 generic 1.2 MB/s | 139 kB 00:00OE Remote Repo: sswreleases rel-v2021.2 generic 4.7 kB/s | 257 B 00:00OE Remote Repo: sswreleases rel-v2021.2 generic 4.3 kB/s | 257 B 00:00...Dependencies resolved.================================================================================ Package Architecture Version Repository Size================================================================================Installing: python3-dev cortexa9t2hf_neon 3.8.5-r0.0 oe-remote-repo-sswreleases-rel-v2021.2-generic-rpm-cortexa9t2hf_neon ......Transaction Summary================================================================================Install 80 Packages Total download size: 3.7 MInstalled size: 19 MIs this ok [y/N]: yDownloading Packages:......root@bora:~#
</pre>
In this way, the <code>asyncua</code> package can be built/installed:
Building wheels for collected packages: cryptography
Building wheel for cryptography (pyproject.toml) ... | / - \ done Created wheel for cryptography: filename=cryptography-3842.0.12-cp38-cp38-linux_armv7l.whl size=1768831 2206468 sha256=1cfd149510ee62605549bde5a24cb6bbd2f959094906ec6d22c4850fd2b6268d27ef627b5636e640bc179ff1ad13948ac029ad3c709d1e137670f6c5fe79c131 Stored in directory: /home/root/.cache/pip/wheels/fbb8/dd2d/3051/687c60465a7b76d3b461f7eb89da28d4f68edc182d625a3ccf9a40e9f8548e174065e9988ad0eece7edf49ece9b2251e0790
Successfully built cryptography
Installing collected packages: sortedcontainers, pytz, typing_extensionstyping-extensions, sixpycparser, pycparseraiosqlite, aiofiles, python-dateutil, cffi, aiosqlitecryptography, cryptographypyOpenSSL, asyncuaSuccessfully installed aiofiles-2223.2.1.0 aiosqlite-0.1719.0 asyncua-1.0.0 6 cffi-1.15.1 cryptography-38.0.1 pycparser-2.21 python-dateutil-2.8.2 pytz-2022.5 six-1.16.0 sortedcontainers-2.4.0 typing_extensionscryptography-4.442.0(desk) root@bora:~# </pre>=== paramiko ===Some package may have some troubles too about the versioning of sub-package. For example, this is the case where <code>paramiko</code> cannot be installed due to some build errors, see [https://github.com/paramiko/paramiko/issues/1761 Paramiko error while building pynacl].This issue can be overcome installing a previous version for <code>PyNaCl</code>: It occurs only with PyNaCl==1.5.0, so you can specify PyNaCl==1.4.0. It's OK because paramiko's requirement is PyNacl>=1.0.1For example, the version '''1.2.0''' can be succesfully installed:<pre class="boardpyOpenSSL-terminal">(desk) root@bora:~# pip3 install PyNaCl==1.2.0Collecting PyNaCl==1.224.0 Downloading PyNaCl-1.2.0.tar.gz (3.3 MB) |████████████████████████████████| 3.3/3.3 MB 2.4 MB/s eta 0:00:00 Preparing metadata (setup.py) ... doneRequirement already satisfied: six in ./env/lib/python3.8/site-packages (from PyNaCl==1.2.0) (1.16.0)Requirement already satisfied: cffi>=1.4.1 in ./env/lib/python3.8/site-packages (from PyNaCl==1.2.0) (1.15.1)Requirement already satisfied: pycparser in ./env/lib/python3.8/site-packages (from cffi>=1.4.1->PyNaCl==1.2.0) (2.21)Building wheels for collected packages: PyNaCl Building wheel for PyNaCl (setup.py) ... done Created wheel for PyNaCl: filename=PyNaCl-1.2.0-cp38-cp38-linux_armv7l.whl size=465695 sha256=b9d81dd6c93cd1b1527683500d2e6efbefaef1fadeddff5bef799cbba5d6dd47 Stored in directory: /home/root/.cache/pip/wheels/c8/a7/4c/f03548f24ea252a853b28a9281ac3d3bb59107432fa5cd0a4eSuccessfully built PyNaClInstalling collected packages: PyNaClSuccessfully installed PyNaCl-1.2.0(desk) root@bora:~# </pre>and the [https://pypi.org/project/paramiko/ paramiko] module is then installed:<pre class="board-terminal">(desk) root@bora:~# pip3 install paramikoCollecting paramiko Downloading paramiko-2.11.0-py2.py3-nonepytz-any.whl (212 kB) |████████████████████████████████| 212.9/212.9 kB 1.5 MB/s eta 0:00:00Collecting bcrypt>=3.12023.3 Downloading bcrypt-4.0.1.tar.gz (25 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... doneRequirement already satisfied: six in ./env/lib/python3.8/sitesortedcontainers-packages (from paramiko) (1.16.0)Requirement already satisfied: pynacl>=1.0.1 in ./env/lib/python3.8/site-packages (from paramiko) (1.2.0)Requirement already satisfied: cryptography>=2.5 in ./env/lib/python3.8/site-packages (from paramiko) (38.0.1)Requirement already satisfied: cffi>=1.12 in ./env/lib/python3.8/site-packages (from cryptography>=2.5->paramiko) (1.15.1)Requirement already satisfied: pycparser in ./env/lib/python3.8/site-packages (from cffi>=1.12->cryptography>=2.5->paramiko) (2.21)Building wheels for collected packages: bcrypt Building wheel for bcrypt (pyproject.toml) ... done Created wheel for bcrypt: filename=bcrypt-4.0.1-cp38typing-cp38-linux_armv7l.whl size=597512 sha256=cc3884972a18b64377fab94c738fc4f2abf0c78ca4d6cb1eec41848fde710078 Stored in directory: /home/root/.cache/pip/wheels/5c/32/05/1f093a4b4e1de66f1cff0a05ef844adbe89dcc027163712ee4Successfully built bcryptInstalling collected packages: bcrypt, paramikoSuccessfully installed bcryptextensions-4.0.1 paramiko-2.119.0(desk) root@bora:~#