Skip to content

Instantly share code, notes, and snippets.

@mikeesto
Created January 5, 2022 12:44
Show Gist options
  • Save mikeesto/663fa83b4bd0943440e10d7c195a4041 to your computer and use it in GitHub Desktop.
Save mikeesto/663fa83b4bd0943440e10d7c195a4041 to your computer and use it in GitHub Desktop.
Install Tensorflow 2 on a Raspberry Pi
# a fresh start
sudo apt-get -y update
sudo apt-get -y upgrade
# remove old versions, if not placed in a virtual environment (let pip search for them)
sudo pip uninstall tensorflow
sudo pip3 uninstall tensorflow
# install the dependencies (if not already onboard)
sudo apt-get install -y gfortran
sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev
sudo apt-get install -y libatlas-base-dev libopenblas-dev libblas-dev
sudo apt-get install -y openmpi-bin libopenmpi-dev
sudo apt-get install -y liblapack-dev cython
sudo pip3 install keras_applications==1.0.8 --no-deps
sudo pip3 install keras_preprocessing==1.1.0 --no-deps
sudo pip3 install -U --user six wheel mock
sudo -H pip3 install pybind11
sudo -H pip3 install h5py==2.10.0
# upgrade setuptools 40.8.0 -> 52.0.0
sudo -H pip3 install --upgrade setuptools
# install gdown to download from Google drive
sudo -H pip install gdown
# download the wheel
gdown https://drive.google.com/uc?id=11mujzVaFqa7R1_lB7q0kVPW22Ol51MPg
# install TensorFlow
sudo -H pip3 install tensorflow-2.2.0-cp37-cp37m-linux_armv7l.whl wrapt --upgrade --ignore-installed
# and complete the installation by rebooting
sudo reboot
# if an older version of tf shows, run pip3 install tensorflow-2.2.0-cp37-cp37m-linux_armv7l.whl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment