TensorFlow服务错误

时间:2017-05-01 18:44:02

标签: tensorflow tensorflow-serving

我已在https://tensorflow.github.io/serving/setup的安装页面上安装了Tensorflow服务。但是,当我按照页面上的构建指令时,我收到以下错误:

$ bazel build tensorflow_serving/...

ERROR: /home/**PATH**/external/org_tensorflow/third_party/py/python_configure.bzl:183:20: unexpected keyword 'environ' in call to repository_rule(implementation: function, *, attrs: dict or NoneType = None, local: bool = False).
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package '': Extension file 'third_party/py/python_configure.bzl' has errors.
INFO: Elapsed time: 0.623s

我在Ubuntu和TensorFlow 1.0.1版本上运行。我正在使用Python 2.7并建立了virtualenv。

我可以成功构建bazel hello示例,也可以完成http://www.grpc.io/docs/quickstart/python.html处的gRPC快速启动。

有什么建议吗?

-Dave

1 个答案:

答案 0 :(得分:1)

麻烦是一个旧的抄本。确定您的版本

$ bazel version
Build label: 0.4.5
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Mar 16 12:19:38 2017 (1489666778)
Build timestamp: 1489666778
Build timestamp as int: 1489666778

在我的情况下,它需要手动删除旧版本

rm -fr ~/.bazel ~/.bazelrc

接下来,我使用ubuntu的安装程序选择安装。

$ ./bazel-0.4.5-installer-linux-x86_64.sh
Bazel installer
---------------

Bazel is bundled with software licensed under the GPLv2 with Classpath exception.
You can find the sources next to the installer on our release page:
   https://github.com/bazelbuild/bazel/releases

# Release 0.4.5 (2017-03-16)

还有另一个技巧让它发挥作用。

$cd ..
$ bazel test tensorflow_serving/...
Python Configuration Error: 'PYTHON_BIN_PATH' environment variable is not set

此错误也与版本控制有关,但在这种情况下,这是服务问题。解决方案是恢复到早期版本并从git更新子模块(我以前克隆了存储库)。从服务目录:

$ git checkout 0.5.1
M   tensorflow
M   tf_models
Note: checking out '0.5.1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 51bb356... Merge pull request #325 from kirilg/0.5.1
(tensorflow) $ git submodule update
Submodule path 'tensorflow': checked out '07bb8ea2379bd459832b23951fb20ec47f3fdbd4'
Submodule path 'tf_models': checked out '2fd3dcf3f31707820126a4d9ce595e6a1547385d'
(tensorflow) $ bazel test tensorflow_serving/...

现在服务报告成功:

INFO: Found 199 targets and 57 test targets...
[1,299 / 4,037] Still waiting for 200 jobs to complete:
      Running (standalone):