pip_import doesn't work with tensorflow
WORKSPACE
http_archive( name = "io_bazel_rules_python", sha256 = "0d1810fecc1bf2b6979d2af60e157d93d3004805bd8b7fda6eb52dda13480dca", strip_prefix = "rules_python-115e3a0dab4291184fdcb0d4e564a0328364571a", urls = ["https://github.com/bazelbuild/rules_python/archive/115e3a0.tar.gz"], ) load("@io_bazel_rules_python//python:pip.bzl", "pip_import") pip_import( name = "pip", requirements = "//:requirements.txt", ) load("@pip//:requirements.bzl", "pip_install") pip_install()
requirements.txt
BUILD
load("@io_bazel_rules_python//python:python.bzl", "py_binary") load("@pip//:requirements.bzl", "requirement") py_binary( name = "test", srcs = ["test.py"], deps = [ requirement("tensorflow"), ], )
test.py
import tensorflow as tf if __name__ == "__main__": pass
Raises:
ImportError: 'No module named tensorflow'