Giter Club home page Giter Club logo

tensorflow-on-raspberry-pi's Introduction

Installing TensorFlow on Raspberry Pi 3 (and probably 2 as well)

Intro

We did it! It took a lot of head-banging and several indirect passings-of-the-torch, but we finally got TensorFlow compiled and running properly on the Raspberry Pi! Hopefully this will enable more hardware-based machine learning projects, as well as making the distributed aspects of TensorFlow more accessible.

Contents

Installing from Pip

Note: These are unofficial binaries (though built from the minimally modified official source), and thus there is no expectation of support from the TensorFlow team. Please don't create issues for these files in the official TensorFlow repository.

This is the easiest way to get TensorFlow onto your Raspberry Pi 3. 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.

First, install the dependencies for TensorFlow:

# 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/raw/master/bin/tensorflow-0.9.0-cp27-none-linux_armv7l.whl
$ sudo pip install tensorflow-0.9.0-cp27-none-linux_armv7l.whl

# For Python 3.3+
$ wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/raw/master/bin/tensorflow-0.9.0-py3-none-any.whl
$ sudo pip install tensorflow-0.9.0-py3-none-any.whl

And that should be it!

Docker image

Instructions on setting up a Docker image to run on Raspberry Pi are being maintained by @romilly here, and a pre-built image is hosted on DockerHub here. Woot!

Troubleshooting

This section will attempt to maintain a list of remedies for problems that may occur while installing from pip

"tensorflow-0.9-cp27-none-linux_armv7l.whl is not a supported wheel on this platform."

This wheel was built with Python 2.7, and can't be installed with a version of pip that uses Python 3. If you get the above message, try running the following command instead:

$ sudo pip2 install tensorflow-0.9-cp27-none-linux_armv7l.whl

Vice-versa for trying to install the Python 3 wheel. If you get the error "tensorflow-0.9-py3-none-any.whl is not a supported wheel on this platform.", try this command:

$ sudo pip3 install tensorflow-0.9-py3-none-any.whl

Building from Source

Step-by-step guide

If you aren't able to make the wheel file from the previous section work, you may need to build from source. Additionally, if you want to use features that have not been included in an official release, such as the initial distributed runtime, you'll have to build from source. Don't worry, as we've figured out most of the quirks of getting it right. The guide will be updated as needed to be as correct as possible.

See the step-by-step guide here. Warning: it takes a while.

Credits

Or: people who did most of the actual work.

While we may have just gotten RPi TensorFlow compiled properly in the last few days (with the most recent grunt work done by myself and @petewarden), this effort has been going on for almost as long as TensorFlow has been open-source, and involves work that spans multiple months in separate codebases. This is an incomprehensive list of people and their work I ran across while working on this.

The majority of the source-building guide is a modified version of these instructions for compiling TensorFlow on a Jetson TK1. Massimiliano, you are the real MVP.

@vmayoral put a huge amount of time and effort trying to put together the pieces to build TensorFlow, and was the first to get something close to a working binary.

A bunch of awesome Googlers working in both the TensorFlow and Bazel repositories helped make this possible. In no particular order: @vrv, @damienmg, @petewarden, @danbri, @ulfjack, @girving, and @nlothian

Issue threads of interest:

License

The file TENSORFLOW_LICENSE applies to any and all files in the bin directory, which are compiled Python wheels for TensorFlow.

Subdirectories contained within the third_party directory each contain relevant licenses for the code and software within those subdirectories.

The file LICENSE applies to other files in this repository. I want to stress that a majority of the lines of code found in the guide of this repository was created by others. If any of those original authors want more prominent attribution, please contact me and we can figure out how to make it acceptable.


Back to top

tensorflow-on-raspberry-pi's People

Contributors

dmaraidonis avatar naturegirl avatar samjabrahams avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.