Google Tensorflow on Raspberry Pi





Introduction: 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


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()




    • Epilog Challenge 9

      Epilog Challenge 9
    • Paper Contest 2018

      Paper Contest 2018
    • Science of Cooking

      Science of Cooking

    We have a be nice policy.
    Please be positive and constructive.


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




    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:

    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.

    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.

    thank u so much for this!!

    very useful information!!

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

    Great tutorial ! Thank you !