deps attribute of py_binary rule ... does not have mandatory provider 'py'

1,253 views
Skip to first unread message

florian...@gmail.com

unread,
Dec 29, 2016, 8:18:28 AM12/29/16
to bazel-discuss
Hi there,

I am new to Bazel and trying to use it to build a TF model, in particular tutorials/embedding [1]. I've cloned the whole "models" repo into a directory called "tensorflow_models" in the top level directory of the "tensorflow" repo itself. So the BUILD file for the embedding model [2] can "see" all the //tensorflow/... goodness.


Now, when I try building this whole model via:

bazel build --copt=-march=native -c opt --config=cuda //tensorflow_models/tutorials/embedding:package

I get:

ERROR: /home/fleitner/src/tensorflow/tensorflow_models/tutorials/embedding/BUILD:32:12: in deps attribute of py_binary rule //tensorflow_models/tutorials/embedding:word2vec: '//tensorflow_models/tutorials/embedding:word2vec_kernels' does not have mandatory provider 'py'.
ERROR: /home/fleitner/src/tensorflow/tensorflow_models/tutorials/embedding/BUILD:46:12: in deps attribute of py_binary rule //tensorflow_models/tutorials/embedding:word2vec_optimized: '//tensorflow_models/tutorials/embedding:word2vec_kernels' does not have mandatory provider 'py'.
ERROR: Analysis of target '//tensorflow_models/tutorials/embedding:package' failed; build aborted.

The problem for me is, I have no clue what this error is trying to tell me.
If I check the word2vec_kernels setup (in [2]), it all looks fine. Indeed, I can even build only the word2vec_kernels objective just fine. So why can't I build the word2vec and word2vec_optimized objectives? What is this "missing provider 'py'" stuff about?

Thanks for any help!

-Florian

[1] https://github.com/tensorflow/models/tree/master/tutorials/embedding

[2] https://raw.githubusercontent.com/tensorflow/models/master/tutorials/embedding/BUILD

Damien Martin-guillerez

unread,
Dec 29, 2016, 8:38:50 AM12/29/16
to florian...@gmail.com, bazel-discuss
Have your ran ./configure?

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/2054ed9c-df2e-464e-a8ed-dd6a2392fca9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

florian...@gmail.com

unread,
Dec 29, 2016, 8:51:15 AM12/29/16
to bazel-discuss, florian...@gmail.com
On Thursday, 29 December 2016 14:38:50 UTC+1, Damien Martin-guillerez wrote:
> Have your ran ./configure?

I did (all inside my clone of the tensorflow repo):

./configure
bazel build --copt=-march=native -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
sudo pip3 install /tmp/tensorflow_pkg/tensorflow-*.whl

With that, I can even bazel build the word2vec_kernel and gen_word2vec targets, as described in my first mail.
In fact, I can successfully work with a CUDA- and CPU-optimized tensorflow in python3.
And I can even run the word2vec.py and word2vec_optimized.py scripts from the command-line ("python3 word2vec.py ..."), as described in the README of the model.

But I don't grok why I can't run a "bazel build" the full model BUILD.
And I have no idea what the error "in deps attribute of py_binary rule ... does not have mandatory provider 'py'" is trying to tell me.

-Florian

Damien Martin-guillerez

unread,
Dec 29, 2016, 8:54:54 AM12/29/16
to florian...@gmail.com, bazel-discuss
It seems like an error in the build file, the word2vec target depends on word2vec_kernels which is a cc_library so not suitable for python deps file (https://github.com/tensorflow/models/blob/master/tutorials/embedding/BUILD#L34). I suggest filing a bug to tensorflow/models.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.

florian...@gmail.com

unread,
Dec 29, 2016, 10:04:25 AM12/29/16
to bazel-discuss, florian...@gmail.com
On Thursday, 29 December 2016 14:54:54 UTC+1, Damien Martin-guillerez wrote:
> It seems like an error in the build file, the word2vec target depends on word2vec_kernels which is a cc_library so not suitable for python deps file (https://github.com/tensorflow/models/blob/master/tutorials/embedding/BUILD#L34). I suggest filing a bug to tensorflow/models.

Well, that sounds like quite the plausible explanation after reading up once more on py_binary [1]. I've filled a bug report, as you suggested [2]. Thank you very much for your quick assistance!

[1] https://www.bazel.io/versions/master/docs/be/python.html#py_binary

[2] https://github.com/tensorflow/models/issues/831

Reply all
Reply to author
Forward
0 new messages