Skip to content

Building TF requires Numpy for Python2 #1737

Closed

Description

@GMNGeoffrey

Latest attempt to update the TF submodule (85c1c19) broke all the GitHub action Bazel builds. It says it can't find numpy, even in the builds where numpy is installed, e.g. https://github.com/google/iree/runs/630505020

This further emphasizes my point that I think we really want any TF deps to be in a separate workspace.

2020-04-29T17:28:28.1486573Z INFO: Call stack for the definition of repository 'local_execution_config_python' which is a local_python_configure (rule definition at /home/runner/.cache/bazel/_bazel_runner/1f3fcd0049c34269c0172521c5537aa9/external/org_tensorflow/third_party/py/python_configure.bzl:275:26):
2020-04-29T17:28:28.1487746Z  - /home/runner/.cache/bazel/_bazel_runner/1f3fcd0049c34269c0172521c5537aa9/external/org_tensorflow/third_party/toolchains/remote_config/rbe_config.bzl:183:5
2020-04-29T17:28:28.1488537Z  - /home/runner/.cache/bazel/_bazel_runner/1f3fcd0049c34269c0172521c5537aa9/external/org_tensorflow/third_party/toolchains/remote_config/rbe_config.bzl:183:5
2020-04-29T17:28:28.1490575Z  - /home/runner/.cache/bazel/_bazel_runner/1f3fcd0049c34269c0172521c5537aa9/external/org_tensorflow/third_party/toolchains/remote_config/configs.bzl:6:5
2020-04-29T17:28:28.1491535Z  - /home/runner/.cache/bazel/_bazel_runner/1f3fcd0049c34269c0172521c5537aa9/external/org_tensorflow/tensorflow/workspace.bzl:93:5
2020-04-29T17:28:28.1492227Z  - /home/runner/work/iree/iree/WORKSPACE:246:1
2020-04-29T17:28:28.1614499Z ERROR: An error occurred during the fetch of repository 'local_execution_config_python':
2020-04-29T17:28:28.1615220Z    Traceback (most recent call last):
2020-04-29T17:28:28.1617847Z 	File "/home/runner/.cache/bazel/_bazel_runner/1f3fcd0049c34269c0172521c5537aa9/external/org_tensorflow/third_party/py/python_configure.bzl", line 213
2020-04-29T17:28:28.1618259Z 		_get_numpy_include(<2 more arguments>)
2020-04-29T17:28:28.1618519Z 	File "/home/runner/.cache/bazel/_bazel_runner/1f3fcd0049c34269c0172521c5537aa9/external/org_tensorflow/third_party/py/python_configure.bzl", line 187, in _get_numpy_include
2020-04-29T17:28:28.1618812Z 		execute(repository_ctx, <3 more arguments>)
2020-04-29T17:28:28.1621380Z 	File "/home/runner/.cache/bazel/_bazel_runner/1f3fcd0049c34269c0172521c5537aa9/external/org_tensorflow/third_party/remote_config/common.bzl", line 208, in execute
2020-04-29T17:28:28.1622087Z 		fail(<1 more arguments>)
2020-04-29T17:28:28.1622684Z Problem getting numpy include path.
2020-04-29T17:28:28.1623023Z Traceback (most recent call last):
2020-04-29T17:28:28.1623234Z   File "<string>", line 1, in <module>
2020-04-29T17:28:28.1623493Z ImportError: No module named numpy
2020-04-29T17:28:28.1623710Z Is numpy installed?
2020-04-29T17:28:28.2322263Z Internal error thrown during build. Printing stack trace: java.lang.IllegalStateException: //bindings/python/pyiree/rt:vm_test BuildConfigurationValue.Key[0e437df5e7f493c0b87663d34f5a059aecde37caf596a3c267b875714f030130] false -> ErrorInfo{exception=com.google.devtools.build.lib.syntax.EvalExceptionWithStackTrace: Traceback (most recent call last):
2020-04-29T17:28:28.2323097Z 	File "/home/runner/.cache/bazel/_bazel_runner/1f3fcd0049c34269c0172521c5537aa9/external/org_tensorflow/third_party/py/python_configure.bzl", line 213
2020-04-29T17:28:28.2323480Z 		_get_numpy_include(<2 more arguments>)
2020-04-29T17:28:28.2323848Z 	File "/home/runner/.cache/bazel/_bazel_runner/1f3fcd0049c34269c0172521c5537aa9/external/org_tensorflow/third_party/py/python_configure.bzl", line 187, in _get_numpy_include
2020-04-29T17:28:28.2324194Z 		execute(repository_ctx, <3 more arguments>)
2020-04-29T17:28:28.2327155Z 	File "/home/runner/.cache/bazel/_bazel_runner/1f3fcd0049c34269c0172521c5537aa9/external/org_tensorflow/third_party/remote_config/common.bzl", line 208, in execute
2020-04-29T17:28:28.2327626Z 		fail(<1 more arguments>)
2020-04-29T17:28:28.2327748Z Problem getting numpy include path.
2020-04-29T17:28:28.2327874Z Traceback (most recent call last):
2020-04-29T17:28:28.2327970Z   File "<string>", line 1, in <module>
2020-04-29T17:28:28.2328103Z ImportError: No module named numpy
2020-04-29T17:28:28.2328277Z Is numpy installed?, rootCauses={REPOSITORY_DIRECTORY:@local_execution_config_python}, cycles=[], isCatastrophic=false, rootCauseOfException=REPOSITORY_DIRECTORY:@local_execution_config_python, isDirectlyTransient=false, isTransitivelyTransient=true}
2020-04-29T17:28:28.2328450Z 	at com.google.common.base.Preconditions.checkState(Preconditions.java:823)
2020-04-29T17:28:28.2328607Z 	at com.google.devtools.build.lib.skyframe.SkyframeBuildView.assertSaneAnalysisError(SkyframeBuildView.java:675)
2020-04-29T17:28:28.2329351Z 	at com.google.devtools.build.lib.skyframe.SkyframeBuildView.processErrors(SkyframeBuildView.java:542)
2020-04-29T17:28:28.2329516Z 	at com.google.devtools.build.lib.skyframe.SkyframeBuildView.configureTargets(SkyframeBuildView.java:454)
2020-04-29T17:28:28.2329668Z 	at com.google.devtools.build.lib.analysis.BuildView.update(BuildView.java:403)
2020-04-29T17:28:28.2329823Z 	at com.google.devtools.build.lib.buildtool.AnalysisPhaseRunner.runAnalysisPhase(AnalysisPhaseRunner.java:213)
2020-04-29T17:28:28.2330206Z 	at com.google.devtools.build.lib.buildtool.AnalysisPhaseRunner.execute(AnalysisPhaseRunner.java:124)
2020-04-29T17:28:28.2330477Z 	at com.google.devtools.build.lib.buildtool.BuildTool.buildTargets(BuildTool.java:142)
2020-04-29T17:28:28.2330643Z 	at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:270)
2020-04-29T17:28:28.2332274Z 	at com.google.devtools.build.lib.runtime.commands.TestCommand.doTest(TestCommand.java:130)
2020-04-29T17:28:28.2332433Z 	at com.google.devtools.build.lib.runtime.commands.TestCommand.exec(TestCommand.java:108)
2020-04-29T17:28:28.2332592Z 	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:543)
2020-04-29T17:28:28.2332748Z 	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:205)
2020-04-29T17:28:28.2332903Z 	at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:601)
2020-04-29T17:28:28.2333039Z 	at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$2(GrpcServerImpl.java:652)
2020-04-29T17:28:28.2333341Z 	at io.grpc.Context$1.run(Context.java:595)
2020-04-29T17:28:28.2333475Z 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
2020-04-29T17:28:28.2333615Z 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
2020-04-29T17:28:28.2333922Z 	at java.base/java.lang.Thread.run(Unknown Source)

Activity

  1. self-assigned this
    on Apr 29, 2020
  2. benvanik commented on Apr 29, 2020

    @benvanik
    Collaborator

    +1 on separate workspace - I'd have a much easier time using bazel if using it to build a non-tf thing didn't also require having tf fully setup

  3. GMNGeoffrey commented on Apr 29, 2020

    @GMNGeoffrey
    MemberAuthor

    Yeah I think the tricky issue is the XLA HLO MLIR dialects. We need them outside of the TF build and they're still in the TF repository :-/ At this point I think I might rather have custom scripts that rewrite the BUILD file rather than take the TF dependency, but it would all be infra work that's on the long list of infra work :-(

  4. benvanik commented on Apr 29, 2020

    @benvanik
    Collaborator

    I think once the shape inference stuff that's dependent on the tf kernel junk gets fixed we'll be in a pretty reasonable place to either clone just the HLO files or continue begging for it to be moved out of repo. Or, we can buy Sean a bunch of caffeinated drinks and see how fast we can get TCP and HLO->TCP done and eject the whole damn thing :P

  5. GMNGeoffrey commented on Apr 30, 2020

    @GMNGeoffrey
    MemberAuthor

    Ugh it's even worse. We have TF deps to get parts of our llvm build files: https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/google/iree%24+%22%40org_tensorflow%22+-f:integrations&patternType=regexp

    e.g.

    load("@org_tensorflow//third_party/mlir:tblgen.bzl", "gentbl")
    load("@org_tensorflow//third_party/mlir:linalggen.bzl", "genlinalg")
  6. GMNGeoffrey commented on Apr 30, 2020

    @GMNGeoffrey
    MemberAuthor

    Yeah this is horribly tangled. The LLVM build files are deeply intertwined with TF. I can bazel build iree/base/... without tf, but that's about it. I think this is theoretically possible, but definitely a PITA....

  7. added a commit that references this issue on May 2, 2020
  8. GMNGeoffrey commented on May 2, 2020

    @GMNGeoffrey
    MemberAuthor

    So working with the TF folks to make toolchain registration optional. I tested out a patch that fixes almost everything, but unfortunately it seems to break the colab build:

    GMNGeoffrey@2a759f2

    https://github.com/GMNGeoffrey/iree/runs/638267343 is the failure.

    ERROR: While resolving toolchains for target @org_tensorflow//tensorflow/core/util:version_info_gen: Unable to find an execution platform for target platform @local_config_platform//:host from available execution platforms []

    and the dependency path for why that gets triggered:

    //colab:everything_for_colab (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    //integrations/tensorflow/bindings/python/pyiree/tf/compiler:compiler (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    //integrations/tensorflow/bindings/python/pyiree/tf/compiler:binding (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    //integrations/tensorflow/bindings/python/pyiree/tf/compiler:binding__shared_objects (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    //integrations/tensorflow/bindings/python/pyiree/tf/compiler:binding.so (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    //integrations/tensorflow/bindings/python/pyiree/tf/compiler:compiler_library (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    @org_tensorflow//tensorflow/cc/saved_model:loader_lite (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    @org_tensorflow//tensorflow/cc/saved_model:loader_lite_impl (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    @org_tensorflow//tensorflow/core:framework (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    @org_tensorflow//tensorflow/core:framework_internal (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    @org_tensorflow//tensorflow/core:framework_internal_headers_lib (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    @org_tensorflow//tensorflow/core:framework_internal_headers_lib_gather (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    @org_tensorflow//tensorflow/core/util:version_info (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    @org_tensorflow//tensorflow/core/util:version_info (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    @org_tensorflow//tensorflow/core/util:version_info.cc (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    @org_tensorflow//tensorflow/core/util:version_info_gen (6ed28c1c50d803fe2de2fe9135479294489d75112fa97147d975777a2f9f8d2a)
    
  9. GMNGeoffrey commented on May 4, 2020

    @GMNGeoffrey
    MemberAuthor

    @ScottTodd can you look into why we can't find numpy on the builds right now?

  10. phoenix-meadowlark commented on May 4, 2020

    @phoenix-meadowlark
    Contributor

    I was able to reproduce this in a docker image, and the fix (sugguested by @GMNGeoffrey) is to install numpy on python2 as well.

    sudo apt-get install python-pip
    python -m pip install --upgrade pip
    python -m pip install numpy
  11. GMNGeoffrey commented on May 4, 2020

    @GMNGeoffrey
    MemberAuthor

    Thanks Phoenix!

  12. 1 remaining item

  13. changed the title [-]Updating TF breaks GitHub action Bazel builds[/-] [+]Building TF requires Numpy for Python2[/+] on Jun 3, 2020
  14. GMNGeoffrey commented on Oct 20, 2020

    @GMNGeoffrey
    MemberAuthor

    As of tensorflow/tensorflow@ddb837a TF at least looks for python3 first, so it no longer depends on python2, which of course broke our current setup. My bad

  15. benvanik commented on Nov 22, 2020

    @benvanik
    Collaborator

    Obsolete?

  16. added
    infrastructure
    integrations/tensorflow
    on Nov 22, 2020
  17. GMNGeoffrey commented on Nov 30, 2020

    @GMNGeoffrey
    MemberAuthor

    Well it at least doesn't require python2 anymore, but we still have to have numpy installed to build our C++ code which is 🤮 I'm still working on untangling our TF dependency and poking the TF folks about trying to make this better. We could rename this issue to be about the IREE core workspace not requiring TF or have a separate one for that

  18. GMNGeoffrey commented on Nov 30, 2020

    @GMNGeoffrey
    MemberAuthor

    Oh looks like we already have an issue for that. Closing in favor of #3311. I will still continue discussion with TF about making it possible to dep on them without configuring 14 tons of Bazel config, but that's not really an IREE issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

infrastructureintegrations/tensorflow

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions