Created
September 19, 2018 07:15
-
-
Save avilleret/04a0d81745dcd3449178e2c962bf453c to your computer and use it in GitHub Desktop.
Building tensorflow 1.7.1 from source on Ubuntu 18.04 to get rid of 'invalid instruction' error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#How to build tensorflow 1.7.1 from source on Ubuntu 18.04 | |
#========================================================= | |
# Bazel | |
## install bazel depencies | |
sudo apt-get install pkg-config zip g++ zlib1g-dev unzip python | |
## download Bazel 0.9 (see compatibility chart on https://www.tensorflow.org/install/install_sources) | |
wget https://github.com/bazelbuild/bazel/releases/download/0.10.0/bazel-0.10.0-installer-linux-x86_64.sh | |
chmod +x bazel-0.10.0-installer-linux-x86_64.sh | |
./bazel-0.10.0-installer-linux-x86_64.sh --user | |
## add ~/bin to PATH | |
echo 'export PATH="$PATH:$HOME/bin"' >> ~/.bashrc | |
# Tensorflow | |
## install tensorflow dependencies | |
sudo apt-get install python3-numpy python3-dev python3-pip python3-wheel | |
## get Tensorflow source version 1.7.1 | |
git clone https://github.com/tensorflow/tensorflow.git --depth=1 --branch=v1.7.1 | |
## configure it | |
cd tensorflow | |
./configure # this is an interactice script, choose /usr/bin/python3 when asking for a python program | |
## build it | |
bazel build --config=mkl --config=opt //tensorflow/tools/pip_package:build_pip_package | |
# have a rest, this takes more than 2h on DpvCam UC | |
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg | |
sudo python3 -m pip install /tmp/tensorflow_pkg/tensorflow-1.7.1-cp36-cp36m-linux_x86_64.whl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment