Reputation: 31
I'm trying to run Tensorflow code downloaded from github tensorflow/models/adversarial_text, but running into a bazel build error. The error looks quite straightforward. But as I haven't used bazel very much before, I'd appreciate any ideas/suggestions about it. The error is below:
ERROR: /home/dasgupta/adversarial_text/BUILD:60:1: no such package 'adversarial_text/data': BUILD file not found on package path and referenced by '//:inputs'.
Inside adversarial_text/BUILD:(line 60 - that gives above error) is the following rule:
py_library(
name = "inputs",
srcs = ["inputs.py"],
deps = [
# tensorflow dep,
"//adversarial_text/data:data_utils",
],
}
But I see that there is a directory called "adversarial_text/data" and inside adversarial_text/data/BUILD there's this rule too:
py_library(
name = "data_utils",
srcs = ["data_utils.py"],
deps = [
# tensorflow dep,
],
)
I tried adding
visibility = ["//adversarial_text:__pkg__"],
right after the deps rule for data_utils, but that didn't solve the problem.
Any ideas what I might be missing here, or what I might need to set/change (environment vars?) to get this to work.
My config: bash on Ubuntu 16.04, Tensorflow 1.2, bazel 0.5 and python 2.7
Upvotes: 3
Views: 10783
Reputation: 128
This should be fixed now, running the code no longer requires bazel as of https://github.com/tensorflow/models/pull/3414
Upvotes: 0
Reputation: 11
So to summarize, this is what I did to make it work, after cloning the project.
1 Create "WORKSPACE" file in adversarial_text/
touch WORKSPACE
2 Edit deps in adversarial_text/BUILD
py_library(
name = "inputs",
srcs = ["inputs.py"],
deps = [
# tensorflow dep,
"//data:data_utils",
],
)
py_test(
name = "graphs_test",
size = "large",
srcs = ["graphs_test.py"],
deps = [
":graphs",
# tensorflow dep,
"//data:data_utils",
],
)
3 add visibility for data_utils in adversarial_text/data/BUILD
py_library(
name = "data_utils",
srcs = ["data_utils.py"],
deps = [
# tensorflow dep,
],
visibility = ["//:__pkg__"],
)
Upvotes: 1
Reputation: 2370
The visibility has to be //:__pkg__
since adversarial_text
is the root of your workspace. And you should try building //:inputs
.
Upvotes: 1