From 19f95ae034e221570c399f354b2ca16f6cb69d06 Mon Sep 17 00:00:00 2001 From: "Matthew D. Scholefield" Date: Thu, 14 Jun 2018 16:33:58 -0500 Subject: [PATCH] Use piwheels for tensorflow on a raspberry pi and upgrade to tensorflow 1.8.0 Way less of a hassle --- requirements.txt | 4 ++-- setup.py | 2 +- setup.sh | 24 +++++++++--------------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/requirements.txt b/requirements.txt index d134a89..7977b6c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,8 +18,8 @@ PyYAML==3.12 scipy==1.0.1 six==1.11.0 speechpy-fast==2.3 -tensorboard==1.7.0 -tensorflow==1.7.0 +tensorboard==1.8.0 +tensorflow==1.8.0 termcolor==1.1.0 typing==3.6.4 wavio==0.0.3 diff --git a/setup.py b/setup.py index d610416..1bb2ee1 100755 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ setup( }, install_requires=[ 'numpy', - 'tensorflow', + 'tensorflow==1.8.0', # Must be on piwheels 'speechpy-fast>=2.4', 'pyaudio', 'keras', diff --git a/setup.sh b/setup.sh index 09ff1a0..830123d 100755 --- a/setup.sh +++ b/setup.sh @@ -22,19 +22,13 @@ wait_for_apt() { fi } vpython() { "$VENV/bin/python" $@; } -vpip() { "$VENV/bin/pip" $@; } - -install_tensorflow_armv7l() { - maj_min=$(python3 -c "import sys; i = sys.version_info; print(str(i[0]) + str(i[1]))") - whl=tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl - ver_whl=${whl//34/$maj_min} - - url=https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v1.1.0/$whl - wget "$url" -O $ver_whl - - vpip install "$ver_whl" - vpip uninstall mock || true; vpip install mock - rm "$ver_whl" +has_piwheels() { cat /etc/pip.conf 2>/dev/null | grep -qF 'piwheels' } +install_piwheels() { + echo "Installing piwheels..." + echo " +[global] +extra-index-url=https://www.piwheels.org/simple +" | sudo tee -a /etc/pip.conf } ############################################# @@ -55,8 +49,8 @@ if [ ! -x "$VENV/bin/pip" ]; then curl https://bootstrap.pypa.io/get-pip.py | vp arch="$(python3 -c 'import platform; print(platform.machine())')" -if [ "$arch" = "armv7l" ] && ! vpython -c 'import tensorflow' 2>/dev/null; then - install_tensorflow_armv7l +if [ "$arch" = "armv7l" ] && ! has_piwheels; then + install_piwheels fi vpip install -e runner/