You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
4.[Install USB Memory as Swap](#4-install-a-memory-drive-as-swap-for-compiling)
25
+
3.[Install USB Memory as Swap](#3-install-a-memory-drive-as-swap-for-compiling)
26
+
4.[Build Bazel](#4-build-bazel)
27
27
5.[Compiling TensorFlow](#5-compiling-tensorflow)
28
28
6.[Cleaning Up](#6-cleaning-up)
29
29
7.[References](#references)
@@ -93,7 +93,7 @@ Now move into the new `protobuf` directory, configure it, and `make` it. _Note:
93
93
94
94
```shell
95
95
cd protobuf
96
-
git checkout v3.0.0
96
+
git checkout v3.1.0
97
97
./autogen.sh
98
98
./configure
99
99
make -j 4
@@ -107,13 +107,74 @@ Great! You should now have `protoc` installed in `/usr/local/bin`, and should be
107
107
protoc --version
108
108
```
109
109
110
-
Now that we have the `protoc` compiler, we can start building Bazel. Let's move up a directory and do that.
110
+
Now that we have the `protoc` compiler, let's install a USB stick as additional swap memory.
111
111
112
112
```
113
113
cd ..
114
114
```
115
115
116
-
### 3. Build Bazel
116
+
### 3. Install a Memory Drive as Swap for Compiling
117
+
118
+
In order to succesfully build TensorFlow, your Raspberry Pi needs a little bit more memory to fall back on. Fortunately, this process is pretty straightforward. Grab a USB storage drive that has at least 1GB of memory. I used a flash drive I could live without that carried no important data. That said, we're only going to be using the drive as swap while we compile, so this process shouldn't do too much damage to a relatively new USB drive.
119
+
120
+
First, put insert your USB drive, and find the `/dev/XXX` path for the device.
121
+
122
+
```shell
123
+
sudo blkid
124
+
```
125
+
126
+
As an example, my drive's path was `/dev/sda1`
127
+
128
+
Once you've found your device, unmount it by using the `umount` command.
129
+
130
+
```shell
131
+
sudo umount /dev/XXX
132
+
```
133
+
134
+
Then format your device to be swap:
135
+
136
+
```shell
137
+
sudo mkswap /dev/XXX
138
+
```
139
+
140
+
If the previous command outputted an alphanumeric UUID, copy that now. Otherwise, find the UUID by running `blkid` again. Copy the UUID associated with `/dev/XXX`
141
+
142
+
```shell
143
+
sudo blkid
144
+
```
145
+
146
+
Now edit your `/etc/fstab` file to register your swap file. (I'm a Vim guy, but Nano is installed by default)
147
+
148
+
```shell
149
+
sudo nano /etc/fstab
150
+
```
151
+
152
+
On a separate line, enter the following information. Replace the X's with the UUID (without quotes)
Save `/etc/fstab`, exit your text editor, and run the following command:
159
+
160
+
```shell
161
+
sudo swapon -a
162
+
```
163
+
164
+
If you get an error claiming it can't find your UUID, go back and edit `/etc/fstab`. Replace the `UUID=XXX..` bit with the original `/dev/XXX` information.
165
+
166
+
```shell
167
+
sudo nano /etc/fstab
168
+
```
169
+
170
+
```bash
171
+
# Replace the UUID with /dev/XXX
172
+
/dev/XXX none swap sw,pri=5 0 0
173
+
```
174
+
175
+
Alright! You've got swap! Don't throw out the `/dev/XXX` information yet- you'll need it to remove the device safely later on.
176
+
177
+
### 4. Build Bazel
117
178
118
179
To build [Bazel](https://github.com/bazelbuild/bazel), we're going to need to download a zip file containing a distribution archive. Let's do that now and extract it into a new directory called `bazel`:
119
180
@@ -156,7 +217,7 @@ Finally, we have to add one thing to `tools/cpp/cc_configure.bzl` - open it up f
156
217
nano tools/cpp/cc_configure.bzl
157
218
```
158
219
159
-
Place the line `return "arm"` around line 141 (at the beginning of the `_get_cpu_value` function):
220
+
Place the line `return "arm"` around line 133 (at the beginning of the `_get_cpu_value` function):
To make sure it's working properly, run `bazel` on the command line and verify it prints help text. Note: this may take 15-30 seconds to run, so be patient!
181
242
182
243
```shell
183
-
$ bazel
244
+
bazel
184
245
185
246
Usage: bazel <command><options> ...
186
247
@@ -217,67 +278,6 @@ Move out of the `bazel` directory, and we'll move onto the next step.
217
278
cd ..
218
279
```
219
280
220
-
### 4. Install a Memory Drive as Swap for Compiling
221
-
222
-
In order to succesfully build TensorFlow, your Raspberry Pi needs a little bit more memory to fall back on. Fortunately, this process is pretty straightforward. Grab a USB storage drive that has at least 1GB of memory. I used a flash drive I could live without that carried no important data. That said, we're only going to be using the drive as swap while we compile, so this process shouldn't do too much damage to a relatively new USB drive.
223
-
224
-
First, put insert your USB drive, and find the `/dev/XXX` path for the device.
225
-
226
-
```shell
227
-
sudo blkid
228
-
```
229
-
230
-
As an example, my drive's path was `/dev/sda1`
231
-
232
-
Once you've found your device, unmount it by using the `umount` command.
233
-
234
-
```shell
235
-
sudo umount /dev/XXX
236
-
```
237
-
238
-
Then format your device to be swap:
239
-
240
-
```shell
241
-
sudo mkswap /dev/XXX
242
-
```
243
-
244
-
If the previous command outputted an alphanumeric UUID, copy that now. Otherwise, find the UUID by running `blkid` again. Copy the UUID associated with `/dev/XXX`
245
-
246
-
```shell
247
-
sudo blkid
248
-
```
249
-
250
-
Now edit your `/etc/fstab` file to register your swap file. (I'm a Vim guy, but Nano is installed by default)
251
-
252
-
```shell
253
-
sudo nano /etc/fstab
254
-
```
255
-
256
-
On a separate line, enter the following information. Replace the X's with the UUID (without quotes)
Save `/etc/fstab`, exit your text editor, and run the following command:
263
-
264
-
```shell
265
-
sudo swapon -a
266
-
```
267
-
268
-
If you get an error claiming it can't find your UUID, go back and edit `/etc/fstab`. Replace the `UUID=XXX..` bit with the original `/dev/XXX` information.
269
-
270
-
```shell
271
-
sudo nano /etc/fstab
272
-
```
273
-
274
-
```bash
275
-
# Replace the UUID with /dev/XXX
276
-
/dev/XXX none swap sw,pri=5 0 0
277
-
```
278
-
279
-
Alright! You've got swap! Don't throw out the `/dev/XXX` information yet- you'll need it to remove the device safely later on.
280
-
281
281
### 5. Compiling TensorFlow
282
282
283
283
First things first, clone the TensorFlow repository and move into the newly created directory.
Next, we need to delete a particular line in `tensorflow/core/platform/platform.h`. Open up the file in your favorite text editor:
299
299
300
300
```shell
301
-
$ sudo nano tensorflow/core/platform/platform.h
301
+
sudo nano tensorflow/core/platform/platform.h
302
302
```
303
303
304
304
Now, scroll down toward the bottom and delete the following line containing `#define IS_MOBILE_PLATFORM` (around line 48):
@@ -315,7 +315,7 @@ This keeps our Raspberry Pi device (which has an ARM CPU) from being recognized
315
315
Now let's configure the build:
316
316
317
317
```shell
318
-
$ ./configure
318
+
./configure
319
319
320
320
Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python
321
321
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] N
@@ -324,9 +324,9 @@ Do you wish to build TensorFlow with Hadoop File System support? [y/N] N
324
324
Please input the desired Python library path to use. Default is [/usr/local/lib/python2.7/dist-packages]
325
325
Do you wish to build TensorFlow with OpenCL support? [y/N] N
326
326
Do you wish to build TensorFlow with GPU support? [y/N]
327
-
N```
327
+
```
328
328
329
-
_Note: if you want to build for Python 3, specify `/usr/bin/python3` for Python's location._
329
+
_Note: if you want to build for Python 3, specify `/usr/bin/python3` for Python's location and `/usr/local/lib/python3.4/dist-packages` for the Python library path._
330
330
331
331
Now we can use it to build TensorFlow! **Warning: This takes a really, really long time. Several hours.**
Copy file name to clipboardExpand all lines: README.md
+24-12Lines changed: 24 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Donate
4
4
5
-
If you find the binaries and instructions in this repository useful, [please consider donating to help keep this repository maintained](https://pledgie.com/campaigns/33260). It takes hours of work for each new version of TensorFlow, as well as responding to issues and pull requests.
5
+
If you find the binaries and instructions in this repository useful, [please consider donating to help keep this repository maintained](https://pledgie.com/campaigns/33260). It takes hours of work to compile each new version of TensorFlow, in addition to time spent responding to issues and pull requests.
6
6
7
7
## Intro
8
8
@@ -25,25 +25,37 @@ This is the easiest way to get TensorFlow onto your Raspberry Pi 3. Note that cu
25
25
First, install the dependencies for TensorFlow:
26
26
27
27
```shell
28
-
$ sudo apt-get update
28
+
sudo apt-get update
29
29
30
30
# For Python 2.7
31
-
$ sudo apt-get install python-pip python-dev
31
+
sudo apt-get install python-pip python-dev
32
32
33
33
# For Python 3.3+
34
-
$ sudo apt-get install python3-pip python3-dev
34
+
sudo apt-get install python3-pip python3-dev
35
35
```
36
36
37
37
Next, download the wheel file from this repository and install it:
Finally, we need to reinstall the `mock` library to keep it from throwing an error when we import TensorFlow:
50
+
51
+
```shell
52
+
# For Python 2.7
53
+
sudo pip uninstall mock
54
+
sudo pip install mock
55
+
56
+
# For Python 3.3+
57
+
sudo pip3 uninstall mock
58
+
sudo pip3 install mock
47
59
```
48
60
49
61
And that should be it!
@@ -56,18 +68,18 @@ Instructions on setting up a Docker image to run on Raspberry Pi are being maint
56
68
57
69
_This section will attempt to maintain a list of remedies for problems that may occur while installing from `pip`_
58
70
59
-
#### "tensorflow-0.11-cp27-none-linux_armv7l.whl is not a supported wheel on this platform."
71
+
#### "tensorflow-0.12.1-cp27-none-linux_armv7l.whl is not a supported wheel on this platform."
60
72
61
73
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:
Vice-versa for trying to install the Python 3 wheel. If you get the error "tensorflow-0.11-py3-none-any.whl is not a supported wheel on this platform.", try this command:
79
+
Vice-versa for trying to install the Python 3 wheel. If you get the error "tensorflow-0.12.1-py3-none-any.whl is not a supported wheel on this platform.", try this command:
0 commit comments