Use piwheels for tensorflow on a raspberry pi and upgrade to tensorflow 1.8.0

Way less of a hassle
pull/101/head
Matthew D. Scholefield 2018-06-14 16:33:58 -05:00
parent b14c4b34b8
commit 19f95ae034
3 changed files with 12 additions and 18 deletions

View File

@ -18,8 +18,8 @@ PyYAML==3.12
scipy==1.0.1 scipy==1.0.1
six==1.11.0 six==1.11.0
speechpy-fast==2.3 speechpy-fast==2.3
tensorboard==1.7.0 tensorboard==1.8.0
tensorflow==1.7.0 tensorflow==1.8.0
termcolor==1.1.0 termcolor==1.1.0
typing==3.6.4 typing==3.6.4
wavio==0.0.3 wavio==0.0.3

View File

@ -41,7 +41,7 @@ setup(
}, },
install_requires=[ install_requires=[
'numpy', 'numpy',
'tensorflow', 'tensorflow==1.8.0', # Must be on piwheels
'speechpy-fast>=2.4', 'speechpy-fast>=2.4',
'pyaudio', 'pyaudio',
'keras', 'keras',

View File

@ -22,19 +22,13 @@ wait_for_apt() {
fi fi
} }
vpython() { "$VENV/bin/python" $@; } vpython() { "$VENV/bin/python" $@; }
vpip() { "$VENV/bin/pip" $@; } has_piwheels() { cat /etc/pip.conf 2>/dev/null | grep -qF 'piwheels' }
install_piwheels() {
install_tensorflow_armv7l() { echo "Installing piwheels..."
maj_min=$(python3 -c "import sys; i = sys.version_info; print(str(i[0]) + str(i[1]))") echo "
whl=tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl [global]
ver_whl=${whl//34/$maj_min} extra-index-url=https://www.piwheels.org/simple
" | sudo tee -a /etc/pip.conf
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"
} }
############################################# #############################################
@ -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())')" arch="$(python3 -c 'import platform; print(platform.machine())')"
if [ "$arch" = "armv7l" ] && ! vpython -c 'import tensorflow' 2>/dev/null; then if [ "$arch" = "armv7l" ] && ! has_piwheels; then
install_tensorflow_armv7l install_piwheels
fi fi
vpip install -e runner/ vpip install -e runner/