Google Tensorflow on Raspberry Pi

Introduction: Google Tensorflow on Raspberry Pi

About: 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 so on. Also, I have spent almost every day of the past 15 ...

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


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

For Python 3.4


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

Finally, we are going to test a simple program.

import tensorflow as tf

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

sess = tf.Session()




  • Fix It! Contest

    Fix It! Contest
  • Creative Misuse Contest

    Creative Misuse Contest
  • Tiny Home Contest

    Tiny Home Contest

16 Discussions

Great tutorial guy........Thanks lot ....I'm worked done with Raspberry pi Noobs OS it's Working......Awesome work dude Thank You..........!!!!!!!!!!!

The Android Things platform is also another alternative to get TensorFlow up and running on the Raspberry Pi. For our test project, we used the TensorFlow Lite version to create the NeuralCandy app that combines image classifier and sugar highs. It uses TensorFlow to locally classify the captured image against the pre-trained ImageNet model, as shown here:

python3 -c 'import tensorflow as tf; print(tf.__version__)'

I followed the above tutorial and didn't get any error while installing tensorflow. But

when in step2- Verifying , when i do

import tensorflow as tf it shows error.

>>> import tensorflow

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

ImportError: No module named 'tensorflow'

Help me....

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.

2 replies

try this 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

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


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

I removed the 'sudo', and the command line works.

many thanks for the instructions. I have installed successfully Tensorflow on my Raspberry Pi 3 running Raspbian. I will start to write code for text classification.