Introduction: Google Tensorflow on Raspberry Pi

Picture of Google Tensorflow on Raspberry Pi

About TensorFlow

TensorFlow™ is an open source software library for numerical computation using data flow graphs. Nodes in the graph represent mathematical operations, while the graph edges represent the multidimensional data arrays (tensors) communicated between them.

Step 1: Installation

This is an easy way to install TensorFlow on your Raspberry Pi. Note that currently, the pre-built binary is targeted for Raspberry Pi 3 running Raspbian 8.0 ("Jessie"), so this may or may not work for you. The specific OS release is the following:

sudo apt-get update

For Python 2.7

sudo apt-get install python-pip python-dev

For Python 3.3+

sudo apt-get install python3-pip python3-dev

Next, download the wheel file from this repository and install it:

For Python 2.7

wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v1.0.1/tensorflow-1.0.1-cp27-none-linux_armv7l.whl

sudo pip install tensorflow-1.0.1-cp27-none-linux_armv7l.whl

For Python 3.4

wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v1.0.1/tensorflow-1.0.1-cp34-cp34m-linux_armv7l.whl

sudo pip3 install tensorflow-1.0.1-cp34-cp34m-linux_armv7l.whl

We need to reinstall the mock library to keep it from throwing an error when we import TensorFlow:

For Python 2.7

sudo pip uninstall mock
sudo pip install mock

For Python 3.3+

sudo pip3 uninstall mock
sudo pip3 install mock

Step 2: Veryfying

Picture of Veryfying

Finally, we are going to test a simple program.

import tensorflow as tf

hello = tf.constant("Hello, TensorFlow!")

sess = tf.Session()

print(sess.run(hello))

Comments

Siddhufunde (author)2017-11-18

got this error when installing tensorflow

"tensorflow-1.0.1-cp34-cp34m-linux_armv7l.whl is not a supported wheel on this platform."

please help.

RafalF2 (author)Siddhufunde2017-11-19

try this whl:

tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl

I had the same issue when installing tensorflow on raspberry 2 and I did not succeed. Then I tried with the raspberry 3 and - success - the issue disapeared

meMitulGoswami (author)2017-11-11

thank u so much for this!!

very useful information!!

You are welcome! If you struggle it, keep asking here.

KevinD27 (author)2017-09-22

Great tutorial ! Thank you !

Stephen LEE (author)KevinD272017-09-23

You are welcome!

PaulAtreides7201 (author)2017-08-30

Great tutorial, just what I needed, thanks!

You are welcome. Enjoy with TensorFlow.

ShubamG2 (author)2017-06-26

thank you so much

Stephen LEE (author)ShubamG22017-06-27

You are welcome!

About This Instructable

4,849views

11favorites

License:

Bio: I am a keen IoT inventor as a hobbyist in Sydney and very passionate about IoT and Algorithms such as MACHINE LEARNING, COMPUTATIONAL STATISTICS and ... More »
More by Stephen LEE:How to Install Node-RED on Jetson BoardsJupyter Notebook on Raspberry PiGoogle Tensorflow on Raspberry Pi
Add instructable to: