Fastai2 on raspberry pi model 4b

Has anyone successfully installed fastai2 on raspberry pi 4. I have installed the PyTorch wheel but during the fastai2 build, I am facing issues.

Can anyone help me with the build wheels?

Well I was hoping to get someone’s reply but nevertheless I found solution though various hit and trial and God’s grace. Below are the steps to install fastai2 for rapberrypi 4b.

I believe support for IOT devices should be there if developers wants to adopt fastai rather than Tensorflow. Even if tensorflow is not better than fastai but with abundant support it may soon become a standard for developers.

sudo apt update && sudo apt upgrade
mkdir project_folder
cd project_folder
python3 -m venv env
source env/bin/activate

pip3 install fastai --no-deps
pip3 install fastai2 --no-deps
pip3 install -Uqq fastbook --no-deps
pip install https://github.com/hoefling/so-59927844/releases/download/0.1/blis-0.4.1-cp37-cp37m-linux_armv7l.whl
pip install https://github.com/hoefling/so-59927844/releases/download/0.1/spacy-2.2.3-cp37-cp37m-linux_armv7l.whl

Install PyTorch dependencies first:
sudo apt install libopenblas-dev libblas-dev m4 cmake cython python3-dev python3-yaml python3-setuptools python3-wheel python3-pillow python3-numpy

sudo apt install libatlas3-base
sudo pip3 install numpy
python3 -m pip install Pillow==6.1

wget https://github.com/sungjuGit/PyTorch-and-Vision-for-Raspberry-Pi-4B/raw/master/torch-1.8.0a0%2B56b43f4-cp37-cp37m-linux_armv7l.whl
wget https://github.com/sungjuGit/PyTorch-and-Vision-for-Raspberry-Pi-4B/raw/master/torchvision-0.9.0a0%2B8fb5838-cp37-cp37m-linux_armv7l.whl

pip3 install torch-1.8.0a0+56b43f4-cp37-cp37m-linux_armv7l.whl 
pip3 install torchvision-0.9.0a0+8fb5838-cp37-cp37m-linux_armv7l.whl

Create new text file in project_folder and copy below contents. Name it requirements.txt

matplotlib
fastcore
fastprogress
packaging
pandas
pyyaml
requests
scikit-learn
scipy
fastcore
fastdownload
beautifulsoup4
bottleneck
numexpr
nvidia-ml-py3
ipywidgets
nbdev


Now type in terminal:
pip3 install -r requirements.txt

To test if everything is installed correctly, log into your python terminal and run the commands:
$ python3.7
import fastbook
fastbook.setup_book()

#WE may get warning and error for graphviz and warning for sentencepiece which can be ignored

from fastbook import *
from IPython.display import display,HTML

If you had reached till here than voilla fastai2 on raspberry pi is installed

1 Like

is this method still working?

I did the same thing but there is error happen when i use (pip install https://github.com/hoefling/so-59927844/releases/download/0.1/blis-0.4.1-cp37-cp37m-linux_armv7l.whl)

it says that the requirements dont match