Skip to content

Instantly share code, notes, and snippets.

@jarutis
Created October 24, 2016 18:37
Show Gist options
  • Star 52 You must be signed in to star a gist
  • Fork 31 You must be signed in to fork a gist
  • Save jarutis/6c2934705298720ff92a1c10f6a009d4 to your computer and use it in GitHub Desktop.
Save jarutis/6c2934705298720ff92a1c10f6a009d4 to your computer and use it in GitHub Desktop.
Install Tensorflow Serving on Centos 7 (CPU)
sudo su
# Java
yum -y install java-1.8.0-openjdk-devel
# Build Esentials (minimal)
yum -y install gcc gcc-c++ kernel-devel make automake autoconf swig git unzip libtool binutils
# Extra Packages for Enterprise Linux (EPEL) (for pip, zeromq3)
yum -y install epel-release
# Python
yum -y install numpy python-devel python-pip
pip install --upgrade pip
# Other TF deps
yum -y install freetype-devel libpng12-devel zip zlib-devel giflib-devel zeromq3-devel
pip install grpcio_tools mock
# HTTP2 Curl
yum -y install libev libev-devel zlib zlib-devel openssl openssl-devel
pushd /var/tmp
git clone https://github.com/tatsuhiro-t/nghttp2.git
cd nghttp2
autoreconf -i
automake
autoconf
./configure
make
sudo make install
echo '/usr/local/lib' > /etc/ld.so.conf.d/custom-libs.conf
ldconfig
popd
pushd /var/tmp
wget http://curl.haxx.se/download/curl-7.46.0.tar.bz2
tar -xvjf curl-7.46.0.tar.bz2
cd curl-7.46.0
./configure --with-nghttp2=/usr/local --with-ssl
make
make install
ldconfig
popd
# Bazel
pushd /var/tmp
wget https://github.com/bazelbuild/bazel/releases/download/0.3.2/bazel-0.3.2-installer-linux-x86_64.sh
chmod +x bazel-*
./bazel-*
export PATH=/usr/local/bin:$PATH
popd
# TF Serving
git clone --recurse-submodules https://github.com/tensorflow/serving
pushd serving
git checkout ec36a91d81e6cd844586eeffdfdc22f415f3b11e # commit used in build
pushd tensorflow
git checkout 4e8497dcdb7918082732c01cf777f3559fc8168b # commit used in build
PYTHON_BIN_PATH=/usr/bin/python PYTHON_LIB_PATH=/usr/lib64/python2.7/site-packages TF_NEED_GCP=0 TF_NEED_HDFS=0 TF_NEED_CUDA=0 ./configure
popd
bazel build -c opt //tensorflow_serving/model_servers:tensorflow_model_server
popd
@liujiabing
Copy link

It's really useful.

@phsieh
Copy link

phsieh commented Nov 16, 2016

Thanks so much for writing this. Saved me a lot of trouble :)

@jusjusjus
Copy link

Does anyone have an update to the above description?

@chenlongzhen
Copy link

thank you !!!!!!

@paulraines68
Copy link

Why is the HTTP2 Curl stuff needed? I skipped that part and it still seems to compile and at least run the Hello test.

@howardking
Copy link

how to use tensorflow serving build a service? how to monitor its status ?

@lkluo
Copy link

lkluo commented Jun 11, 2018

Any update on the latest tfs 1.8 version? Thank.

@Xnsam
Copy link

Xnsam commented Jun 13, 2018

Hi,
Thanks alot, its really helpful
But one problem for me when I do
"git checkout 4e8497dcdb7918082732c01cf777f3559fc8168b"

following error is produced.
fatal: reference is not a tree: 4e8497dcdb7918082732c01cf777f3559fc8168b

Please can u suggest something?

@Simurgh818
Copy link

Hi, Thanks!

I also got the error Xnsam got. when I tried # git checkout 4e8497dcdb7918082732c01cf777f3559fc8168b

I got:
fatal: reference is not a tree: 4e8497dcdb7918082732c01cf777f3559fc8168b

Do we need a different tree?

@sausax
Copy link

sausax commented Sep 13, 2018

@Simurgh818 Run git submodule update --init --recursive from serving base dir.

@gglinux
Copy link

gglinux commented Sep 21, 2018

Nice!

@qiaohaoforever
Copy link

how about GPU?

@dsnlevi
Copy link

dsnlevi commented Dec 28, 2018

I accord this guide to compile the latest tensorflow serving project. when i execute 'bazel build -c opt tensorflow_serving/..' to build the project. it's failed, the error message is:

ERROR: error loading package '': in /opt/serving/tensorflow_serving/workspace.bzl: Encountered error while reading extension file 'tensorflow/workspace.bzl': no such package '@org_tensorflow//tensorflow': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/6d5095a052deba4eb8db2d2a90534a52e454a5c5.tar.gz, https://github.com/tensorflow/tensorflow/archive/6d5095a052deba4eb8db2d2a90534a52e454a5c5.tar.gz] to /root/.cache/bazel/_bazel_root/9886c9acf011eba2b5d5f211eb97e970/external/org_tensorflow/6d5095a052deba4eb8db2d2a90534a52e454a5c5.tar.gz: All mirrors are down: [sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]
ERROR: error loading package '': in /opt/serving/tensorflow_serving/workspace.bzl: Encountered error while reading extension file 'tensorflow/workspace.bzl': no such package '@org_tensorflow//tensorflow': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/6d5095a052deba4eb8db2d2a90534a52e454a5c5.tar.gz, https://github.com/tensorflow/tensorflow/archive/6d5095a052deba4eb8db2d2a90534a52e454a5c5.tar.gz] to /root/.cache/bazel/_bazel_root/9886c9acf011eba2b5d5f211eb97e970/external/org_tensorflow/6d5095a052deba4eb8db2d2a90534a52e454a5c5.tar.gz: All mirrors are down: [sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]

does anyone know how to fix this error? thanks!

@amrithadevadiga
Copy link

Hi ,

Can some one give me steps to build TF Serving version 1.10.0 model on centos7 image

@amrithadevadiga
Copy link

I got error when i tried "PYTHON_BIN_PATH=/usr/bin/python PYTHON_LIB_PATH=/usr/lib64/python2.7/site-packages TF_NEED_GCP=0 TF_NEED_HDFS=0 TF_NEED_CUDA=0 ./configure"

./configure
/opt/serving/tensorflow /opt/serving/tensorflow
Configuration finished
Extracting Bazel installation...
................
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
...............
ERROR: package contains errors: tensorflow/contrib/tfprof/tools/tfprof.
ERROR: error loading package 'tensorflow/contrib/tfprof/tools/tfprof': Encountered error while reading extension file 'protobuf.bzl': no such package '@protobuf//': Error downloading from http://github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz to /root/.cache/bazel/_bazel_root/63bc662b7997fee52d5aa0a4b43a169e/external/protobuf: Downloaded file at /root/.cache/bazel/_bazel_root/63bc662b7997fee52d5aa0a4b43a169e/external/protobuf/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz has SHA-256 of be787d476f8fbda86aaa8fef9054ba5ea66c8ab684f39beac48c6f4744eba0c2, does not match expected SHA-256 (2737ad055eb8a9bc63ed068e32c4ea280b62d8236578cb4d4120eb5543f759ab).

can some one give me solution

@amrithadevadiga
Copy link

Hi all,

How to start the bin (tensorflow_model_server)

@phuhung273
Copy link

I got error when i tried "PYTHON_BIN_PATH=/usr/bin/python PYTHON_LIB_PATH=/usr/lib64/python2.7/site-packages TF_NEED_GCP=0 TF_NEED_HDFS=0 TF_NEED_CUDA=0 ./configure"

./configure
/opt/serving/tensorflow /opt/serving/tensorflow
Configuration finished
Extracting Bazel installation...
................
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
...............
ERROR: package contains errors: tensorflow/contrib/tfprof/tools/tfprof.
ERROR: error loading package 'tensorflow/contrib/tfprof/tools/tfprof': Encountered error while reading extension file 'protobuf.bzl': no such package '@protobuf//': Error downloading from http://github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz to /root/.cache/bazel/_bazel_root/63bc662b7997fee52d5aa0a4b43a169e/external/protobuf: Downloaded file at /root/.cache/bazel/_bazel_root/63bc662b7997fee52d5aa0a4b43a169e/external/protobuf/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz has SHA-256 of be787d476f8fbda86aaa8fef9054ba5ea66c8ab684f39beac48c6f4744eba0c2, does not match expected SHA-256 (2737ad055eb8a9bc63ed068e32c4ea280b62d8236578cb4d4120eb5543f759ab).

can some one give me solution

Did you find any solution to this error ?

@yycsu
Copy link

yycsu commented Apr 30, 2021

I got error when i tried "PYTHON_BIN_PATH=/usr/bin/python PYTHON_LIB_PATH=/usr/lib64/python2.7/site-packages TF_NEED_GCP=0 TF_NEED_HDFS=0 TF_NEED_CUDA=0 ./configure"

./configure
/opt/serving/tensorflow /opt/serving/tensorflow
Configuration finished
Extracting Bazel installation...
................
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
...............
ERROR: package contains errors: tensorflow/contrib/tfprof/tools/tfprof.
ERROR: error loading package 'tensorflow/contrib/tfprof/tools/tfprof': Encountered error while reading extension file 'protobuf.bzl': no such package '@protobuf//': Error downloading from http://github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz to /root/.cache/bazel/_bazel_root/63bc662b7997fee52d5aa0a4b43a169e/external/protobuf: Downloaded file at /root/.cache/bazel/_bazel_root/63bc662b7997fee52d5aa0a4b43a169e/external/protobuf/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz has SHA-256 of be787d476f8fbda86aaa8fef9054ba5ea66c8ab684f39beac48c6f4744eba0c2, does not match expected SHA-256 (2737ad055eb8a9bc63ed068e32c4ea280b62d8236578cb4d4120eb5543f759ab).

can some one give me solution

I also have this error, can anyone help, stuck for two days.. please!!!@jarutis @sausax @amrithadevadiga @liujiabing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment