tensorflow-on-raspberry-pi icon indicating copy to clipboard operation
tensorflow-on-raspberry-pi copied to clipboard

Un-sudo the guide

Open samjabrahams opened this issue 7 years ago • 1 comments

Context

Right now, the project relies on having the user sudo pretty much everything: pip installs, compiling Bazel, etc. However, it would be best if this project could practice the safest security practices possible, which would mean removing as many sudo commands as possible. A number of users have suggested making changes along these lines:

I tried altering the instructions to use pip install --user, instead of sudo pip install, but unfortunately this caused bugs for many users, and these changes was reverted:

Current status

So far, I've kept the README and GUIDE as-is because they work (generally). Right now, I'm prioritizing functionality over safety (which is a point worth arguing over), but the hope is to have our cake and eat it too.

The hope is to remove sudo from every step that involves running a Python or bash script. This currently includes the following commands:

README.md
sudo pip install tensorflow-1.0.1-cp27-none-linux_armv7l.whl
sudo pip3 install tensorflow-1.0.1-cp34-cp34m-linux_armv7l.whl
sudo pip2 install tensorflow-1.0.1-cp27-none-linux_armv7l.whl
sudo pip uninstall mock
sudo pip install mock
sudo pip3 uninstall mock
sudo pip3 install mock

GUIDE.md:
sudo pip install wheel
sudo pip3 install wheel
sudo ./compile.sh
sudo pip install /tmp/tensorflow_pkg/tensorflow-1.0.1-cp27-none-linux_armv7l.whl

Testing

Making sure that these changes work properly requires some form of testing. Creating a testing protocol has been on the backburner for a while (#32), but it's the best way to make sure that the created binaries actually work correctly (as opposed to just appearing to work correctly on first glance). I still don't have the time to focus on this, but it's important to mention.

On Virtualenv

I think the "best" solution for users wanting to install the TensorFlow binaries safely is to have them use a Virtualenv. That said, I don't want to include creating a Virtualenv as part of the build instructions. Unfortunately, this is more about my predictions about issues getting raised along the lines of the format:

Issue: "No module named tensorflow"

Answer: Did you `source /envs/tensorflow/bin/activate`?

This is definitely more about my personal preferences as the maintainer than it is about doing what's "optimal". The thing is, I just don't have the time to help users debug these sorts of problems, so I'm going to avoid adding additional issue-causing surfaces.

As a compromise, I think adding links to the official TensorFlow guide on installing with Virtualenv to the README should be enough to provide users with the resources to figure it out on their own.

samjabrahams avatar Apr 29 '17 19:04 samjabrahams

I recieved an error when accidently trying to ./compile.sh without sudo .. system is

Ubuntu Mate 16.x Raspberry Pi 2

cannot create regular file 'output/bazel': Permission denied

ERROR: could not copy '/tmp/bazel_hashhash/out/execroot/bazel/bazel-out/local-opt/bin/src/bazel' to 'output/bazel'

EMCP avatar Sep 22 '17 07:09 EMCP