Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gotomypc/5c8a4090a0ad162d70ccd01e2e9fceeb to your computer and use it in GitHub Desktop.
Save gotomypc/5c8a4090a0ad162d70ccd01e2e9fceeb to your computer and use it in GitHub Desktop.
TensorFlow Serving Ubuntu 14.04

Instructions for installing TensorFlow Serving on Ubuntu 14.04. I am following the instuctions from here.

Install Bazel

Installation instructions can be found here

If you have a previous version of bazel, and you are trying to do a fresh install then you should remove your old version of bazel. If you installed it through apt, then you can do sudo apt-get purge bazel. If you installed it from source, then you probably have a ~/bin directory with the bazel command, which you should delete, and you probably have a ~/.bazel directory that you should delete. Also check your ~/.bashrc file for any links to ~/.bazel.

  1. Install JDK 8 You'll need the add-apt-repository command, which you can get by doing sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
  1. Add Bazel distribution URI as a package source
$ echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
$ curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
  1. Install and update Bazel
$ sudo apt-get update && sudo apt-get install bazel
  1. Future updates To upgrade bazel, just do:
$ sudo apt-get upgrade bazel

Instal gRPC

Installation instructions are here

# Activate your virtualenv if you are using one
$ pip install --upgrade grpcio

Install dependencies

You probably have most of these dependencies. If you are using a virtualenv then you probably have the python packages too. You should modify this command for your current setup.

$ sudo apt-get update && sudo apt-get install -y \
        build-essential \
        curl \
        libcurl3-dev \
        git \
        libfreetype6-dev \
        libpng12-dev \
        libzmq3-dev \
        pkg-config \
        python-dev \
        python-numpy \
        python-pip \
        software-properties-common \
        swig \
        zip \
        zlib1g-dev

For example, I used this command to see what I actually need:

$ sudo apt-get -s install -y \
        build-essential \
        curl \
        libcurl3-dev \
        git \
        libfreetype6-dev \
        libpng12-dev \
        libzmq3-dev \
        pkg-config \
        software-properties-common \
        swig \
        zip \
        zlib1g-dev

And then installed what I needed:

$ sudo apt-get install -y libcurl3-dev

Clone the TensorFlow Serving repo

$ git clone --recurse-submodules https://github.com/tensorflow/serving
$ cd serving

Configure TensorFlow

You'll need to provide different configuration settings depending on your environment. I find that the defaults usually work.

$ cd tensorflow
$ ./configure
$ cd ..

Build

$ bazel build tensorflow_serving/...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment