Skip to content
David Salek edited this page Nov 14, 2017 · 2 revisions

This wiki describes my attempt to install TensorFlow Serving on a Raspberry Pi Zero. I followed the instructions in https://github.com/samjabrahams/tensorflow-on-raspberry-pi/blob/master/GUIDE.md specific to Raspberry Pi 2 or 3 Model B. I failed to build Bazel, receiving an error related to the CPU architecture.


Increase swap memory

Increase the swap memory size in /etc/dphys-swapfile

CONF_SWAPSIZE=2048
free -h
sudo dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
sudo mkswap /var/swap.img
sudo swapon /var/swap.img
free -h

After compilation, you may remove the swap memory.

sudo swapoff /var/swap.img
sudo rm /var/swap.img

Build Bazel

sudo apt-get update && sudo apt-get install oracle-java8-jdk
java -version
wget https://github.com/bazelbuild/bazel/releases/download/0.5.4/bazel-0.5.4-dist.zip
unzip -d bazel bazel-0.5.4-dist.zip

Add -J-Xmx500M to the line below in scripts/bootstrap/compile.sh

  run "${JAVAC}" -classpath "${classpath}" -sourcepath "${sourcepath}" \
      -d "${output}/classes" -source "$JAVA_VERSION" -target "$JAVA_VERSION" \
      -encoding UTF-8 "@${paramfile}" -J-Xmx500M
sudo ./compile.sh

Unfortunately, I am getting the following error at the end...

ERROR: No toolchain found for cpu 'arm'. Valid cpus are: [
  piii,
  armeabi-v7a,
  x64_windows_msvc,
  x64_windows_msys,
  s390x,
  ios_x86_64,
].
Clone this wiki locally