How to install TensorFlow on a Raspberry Pi 2
I'm trying to install TensorFlow on a Raspberry Pi 2 with a Raspian Lite system installed and an 8GB SD card. I am using Python version 2.7.9 and I am trying to install TensorFlow for it. I have searched before and tried to solve the problem but couldn't do it. These tutorials have already followed:
- TensorFlow Official Guide
- IotMakerBlog Guide
- The Sam J Abrahams Guide to GitHub
I have also read many solutions suggested in some other questions, but the problem is always the same:
tensorflow-1.1.0-cp27-none-linux_armv7l.whl is not a supported wheel on this platform.
This happens every time I try to download .whl and use pip to install it. Moreover, if I try to use pip directly, I get the following:
# pip install tensorflow
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
I also tried with pip2 as suggested in some guides and I also tried installing Python version 3. The result is the same as here.
Can anyone help me? Many thanks.
source to share
You can follow this:
First, install the dependencies for TensorFlow:
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
Then download the wheels file from this repository and install it:
# For Python 2.7
wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v1.1.0/tensorflow-1.1.0-cp27-none-linux_armv7l.whl
sudo pip install tensorflow-1.1.0-cp27-none-linux_armv7l.whl
# For Python 3.4
wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v1.1.0/tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl
sudo pip3 install tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl
Finally, we need to reinstall the mock library so it doesn't throw an error when importing 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
See tensorflow-on-raspberry-pi for details .
source to share
@all, I noticed that you tried to run tensorflow program on Raspberry Pi 2. If you want to try tensorflow lite on Raspberry Pi 3 too, my pull-request might be helpful. My contribution to https://github.com/tensorflow/tensorflow/pull/24194 .
Following my steps, you can run 2 apps on your Raspberry Pi 3 to start your own development, label_image and camera.
Best,
--Jim
source to share