diff --git a/README.md b/README.md index 260282a72902ebc701104d50f621cbc6c0b020db..66c96618f5f397113b34f9e95c698a45cdf29c74 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,13 @@ - Jupyter-lab is served on `0.0.0.0:8888` with an empty password. This of course has security implications and should be discussed - Install the following python3 packages: - numpy - - sklearn + - scikit-learn (aka. sklearn) - matplotlib - pandas - Pillow -- On the desktop version of Raspberry Pi OS, `pil` and `numpy` are preinstalled from the APT repository and will be removed in favour the `pip3` versions. This behavior should be discussed, as there might be further problems caused by incompatible packages depending on the use of either APT or pip python packages + - seaborn + - plotly +- All python packages are installed into a virtual environment at `~/.ml-venv`. This also includes jupyter-lab which allows for using the default python3 kernel and still having access to all dependencies ### The project is structured as follows: - [local.yml](./local.yml): The main playbook file, can be seen as the entry point @@ -22,7 +24,6 @@ - [ml-python-packages](./roles/ml-python-packages/tasks/main.yml): Install the machine learning python packages - # Using the ansible playbook on Raspberry Pi OS Steps to run the ansible script on a fresh (or not fresh) installation of raspberry pi os: @@ -33,16 +34,15 @@ sudo apt update sudo apt install -y --no-install-recommends ansible git # Pull and run the ansible scripts from git -# NOTE: Since the repository is currently private, the gitlab login prompt will shown. When using -# 2FA for gitlab the password login is not possible and an access token is needed. This will be -# fixed in the future -sudo ansible-pull -U https://code.fbi.h-da.de/pse-ai-at-the-edge/raspberry-pi-setup.git +ansible-pull -U https://code.fbi.h-da.de/pse-ai-at-the-edge/raspberry-pi-setup.git ``` # Notes -## 64-Bit Raspberry Pi OS (Desktop) +## Raspberry Pi OS Version and Architecture +This current version of the playbook will install a prebuilt `tensorflow-2.7` wheel that only works on `Python3.9` and the `Aarch64` architecture. +That means for now the playbook **only works on Raspberry Pi OS 11 64-bit** -There were major problems when trying to install the software on 64-Bit Pi OS. Multiple python packages started to compile C/C++ library code on the device which caused extreme increases of installation times and full failures due to the 1GB RAM on model 3B beeing completely used up. Jupyter-lab also needed an additional dependency (`libffi-dev`) to compile its backend. This behavior occurred when installing packages using `pip3`, but not when using APT. Since some packages are not available, or too old on APT pip can't be fully avoided. +### Updating the playbook for 32-bit Raspberry Pi OS +Besides `tensorflow` all other dependencies will pretty much work regardless of architecture and python3 version. So to make this playbook work on 32-bit a decision must be made depending on the architecture. On 32-bit a different prebuilt `tensorflow` wheel must be used, as well as another `numpy` version. -This might be caused by those python libraries depending on C/C++ code which is either shipped precompile or build on device. In this case there might be a precompiled version available for armv7 (32-bit) but not for aarch64 (64-bit), causing the C/C++ code to be compiled on device with the 64-bit OS and not with the 32-bit OS. diff --git a/roles/ml-python-packages/tasks/main.yml b/roles/ml-python-packages/tasks/main.yml index c28fe2a8fde7d2d165bc01b9cb20aaeaaced23bd..84a9da7bf65dd084e31a36eeade276d0364ffdb4 100644 --- a/roles/ml-python-packages/tasks/main.yml +++ b/roles/ml-python-packages/tasks/main.yml @@ -36,5 +36,7 @@ when: "tfinstalled.rc != 0" - name: Download and install prebuilt tensorflow wheel + become: true + become_user: "{{ target_user }}" shell: ". /home/{{ target_user }}/.ml-venv/bin/activate && bash /tmp/tensorflow-install.sh" when: "tfinstalled.rc != 0"