ImportError:无法导入名称tensorboard_server

时间:2016-02-09 12:38:12

标签: python-2.7 tensorflow tensorboard

因为我提取了tensorflow存储库的最新更新,我发现张量板不再起作用了。我使用bazel-0.1.4从源代码安装。之后,我按如下方式构建了张量板:

bazel build tensorflow/tensorboard:tensorboard

然后,当我用:

运行它时
bazel-bin/tensorflow/tensorboard/tensorboard

我收到错误:

Traceback (most recent call last):
File "/home/username/tensorflow/bazel-bin/tensorflow/tensorboard/tensorboard.runfiles/tensorflow/tensorboard/backend/tensorboard.py", line 36, in <module>
from tensorflow.tensorboard.backend import tensorboard_server
ImportError: cannot import name tensorboard_server

出了什么问题?有人能帮助我吗?

1 个答案:

答案 0 :(得分:1)

看起来recent commit添加了新模块tensorboard_server,但没有将其列为张量板的依赖项。

我通过添加以下部分修改了tensorflow / tensorboard / BUILD:

py_library(
    name = "tensorboard_server",
    srcs = ["backend/tensorboard_server.py"],
    deps = [
        ":float_wrapper",
        "//tensorflow/python:platform",
        "//tensorflow/python:summary",
    ],
    srcs_version = "PY2AND3",
)

并将":tensorboard_server"添加到tensorboard二进制文件的依赖项中。

在此之后,我按照您的指定构建并运行了tensorboard,它似乎可以工作:

$ bazel build tensorflow/tensorboard:tensorboard
INFO: Found 1 target...
Target //tensorflow/tensorboard:tensorboard up-to-date:
  bazel-bin/tensorflow/tensorboard/tensorboard
INFO: Elapsed time: 0.425s, Critical Path: 0.10s
$ bazel-bin/tensorflow/tensorboard/tensorboard --logdir .
Starting TensorBoard 13 on port 6006
(You can navigate to http://0.0.0.0:6006)