Machine Learning is a great and exciting subject in computer science and the recent advances are very promising. The only disadvantage of all current developments is the necessity of having more and more powerful GPUs for the application of artificial intelligence (AI).
From my view artificial intelligence and machine learning can only go main-stream if they can run on smaller mobile devices such as the Raspberry Pi.
This is why I was very excited when I successfully installed TensorFlow, which is a popular machine learning library, on the Raspberry Pi 3. With below method it probably can be installed on older Pis too, but will certainly be slower.

Installation of TensorFlow in a Virtual Environment

The first thing to do is to intall the virtual environment as discribed in the TensorFlow website:

  1. Install pip and Virtualenv.
  2. Create a Virtualenv environment.
  3. Activate the Virtualenv environment and install TensorFlow in it.
  4. After the install you will activate the Virtualenv environment each time you want to use TensorFlow.

Here are the details of above steps:
1. Install pip and Virtualenv:

2. Create a Virtualenv environment in the directory ~/tensorflow:

3. Activate the environment:

4. Install TensorFlow just as you would for a regular Pip installation. First select the Raspberry Pi binary to install:

Finally install TensorFlow for Python 2

The last produces some exceptions. However TensorFlow is installed and can be imported in Python.

Testing TensorFlow on the Raspberry Pi

Try this simple TensorFlow Hello World example:

Or test with TensorFlow Example:


Thanks to the work of Sam Abrahams TensorFlow now can be installed on the Raspberry Pi and you can learn Machine Learning skills just using the $35 Pi. This is very exciting, as it opens the world of Machine Learning to hobbyists who want to apply this to their mobile devices or robots.

I can’t wait to add to this article in the following days further examples.
And I also can’t wait to read about your thoughts and insights into this exciting field.