ImportError:在tensorflow构建中没有名为内置模块的模块

时间:2019-07-04 15:48:17

标签: python macos tensorflow build bazel

提交时:

commit 11d02666e312690d770a1c701d30d29ccc987ff2 (HEAD -> master, origin/master, origin/HEAD)
Author: A. Unique TensorFlower <gardener@tensorflow.org>
Date:   Thu Jul 4 07:29:08 2019 -0700

    Fix uses of private, mangled names for proto enumerators.

    PiperOrigin-RevId: 256549401

构建工具:

time bazel build tensorflow/tools/graph_transforms:summarize_graph


INFO: Options provided by the client:
  Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'build' from /Users/my_user/external_projects/tensorflow/.bazelrc:
  'build' options: --apple_platform_type=macos --define framework_shared_object=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone --strategy=Genrule=standalone -c opt --announce_rc --define=grpc_no_ares=true --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include
Loading: 
Loading: 0 packages loaded
DEBUG: Rule 'io_bazel_rules_docker' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1556410077 -0400"
Analyzing: target //tensorflow/tools/graph_transforms:summarize_graph (0 packages loaded, 0 targets configured)
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_my_user/747948fb577123a5771581be02ddf56a/external/org_tensorflow/tensorflow/tools/git/gen_git_source.py", line 29, in <module>
    from builtins import bytes  # pylint: disable=redefined-builtin
ImportError: No module named builtins
INFO: An error occurred during the fetch of repository 'local_config_git'
INFO: Call stack for the definition of repository 'local_config_git':
 - /Users/my_user/external_projects/tensorflow/tensorflow/workspace.bzl:72:5
 - /Users/my_user/external_projects/tensorflow/WORKSPACE:19:1
INFO: An error occurred during the fetch of repository 'fft2d'
INFO: Call stack for the definition of repository 'fft2d':
 - /Users/my_user/external_projects/tensorflow/tensorflow/workspace.bzl:579:5
 - /Users/my_user/external_projects/tensorflow/WORKSPACE:19:1
INFO: An error occurred during the fetch of repository 'farmhash_archive'
INFO: Call stack for the definition of repository 'farmhash_archive':
 - /Users/my_user/external_projects/tensorflow/tensorflow/workspace.bzl:236:5
 - /Users/my_user/external_projects/tensorflow/WORKSPACE:19:1
INFO: An error occurred during the fetch of repository 'highwayhash'
INFO: Call stack for the definition of repository 'highwayhash':
 - /Users/my_user/external_projects/tensorflow/third_party/highwayhash/workspace.bzl:6:5
 - /Users/my_user/external_projects/tensorflow/tensorflow/workspace.bzl:41:5
 - /Users/my_user/external_projects/tensorflow/tensorflow/workspace.bzl:80:5
 - /Users/my_user/external_projects/tensorflow/WORKSPACE:19:1
INFO: An error occurred during the fetch of repository 'com_googlesource_code_re2'
INFO: Call stack for the definition of repository 'com_googlesource_code_re2':
 - /Users/my_user/external_projects/tensorflow/tensorflow/workspace.bzl:189:5
 - /Users/my_user/external_projects/tensorflow/WORKSPACE:19:1
INFO: An error occurred during the fetch of repository 'jsoncpp_git'
INFO: Call stack for the definition of repository 'jsoncpp_git':
 - /Users/my_user/external_projects/tensorflow/tensorflow/workspace.bzl:544:5
 - /Users/my_user/external_projects/tensorflow/WORKSPACE:19:1
INFO: An error occurred during the fetch of repository 'aws'
INFO: Call stack for the definition of repository 'aws':
 - /Users/my_user/external_projects/tensorflow/third_party/aws/workspace.bzl:9:5
 - /Users/my_user/external_projects/tensorflow/tensorflow/workspace.bzl:39:5
 - /Users/my_user/external_projects/tensorflow/tensorflow/workspace.bzl:80:5
 - /Users/my_user/external_projects/tensorflow/WORKSPACE:19:1
ERROR: /Users/my_user/external_projects/tensorflow/tensorflow/core/BUILD:2818:1: no such package '@local_config_git//': Traceback (most recent call last):
    File "/Users/my_user/external_projects/tensorflow/third_party/git/git_configure.bzl", line 61
        _fail(result.stderr)
    File "/Users/my_user/external_projects/tensorflow/third_party/git/git_configure.bzl", line 14, in _fail
        fail(("%sGit Configuration Error:%s %...)))
Git Configuration Error: Traceback (most recent call last):
  File "/private/var/tmp/_bazel_my_user/747948fb577123a5771581be02ddf56a/external/org_tensorflow/tensorflow/tools/git/gen_git_source.py", line 29, in <module>
    from builtins import bytes  # pylint: disable=redefined-builtin
ImportError: No module named builtins

 and referenced by '//tensorflow/core:version_info_gen'
ERROR: /Users/my_user/external_projects/tensorflow/tensorflow/core/BUILD:2818:1: no such package '@local_config_git//': Traceback (most recent call last):
    File "/Users/my_user/external_projects/tensorflow/third_party/git/git_configure.bzl", line 61
        _fail(result.stderr)
    File "/Users/my_user/external_projects/tensorflow/third_party/git/git_configure.bzl", line 14, in _fail
        fail(("%sGit Configuration Error:%s %...)))
Git Configuration Error: Traceback (most recent call last):
  File "/private/var/tmp/_bazel_my_user/747948fb577123a5771581be02ddf56a/external/org_tensorflow/tensorflow/tools/git/gen_git_source.py", line 29, in <module>
    from builtins import bytes  # pylint: disable=redefined-builtin
ImportError: No module named builtins

 and referenced by '//tensorflow/core:version_info_gen'
ERROR: /Users/my_user/external_projects/tensorflow/tensorflow/core/BUILD:2818:1: no such package '@local_config_git//': Traceback (most recent call last):
    File "/Users/my_user/external_projects/tensorflow/third_party/git/git_configure.bzl", line 61
        _fail(result.stderr)
    File "/Users/my_user/external_projects/tensorflow/third_party/git/git_configure.bzl", line 14, in _fail
        fail(("%sGit Configuration Error:%s %...)))
Git Configuration Error: Traceback (most recent call last):
  File "/private/var/tmp/_bazel_my_user/747948fb577123a5771581be02ddf56a/external/org_tensorflow/tensorflow/tools/git/gen_git_source.py", line 29, in <module>
    from builtins import bytes  # pylint: disable=redefined-builtin
ImportError: No module named builtins

 and referenced by '//tensorflow/core:version_info_gen'
ERROR: Analysis of target '//tensorflow/tools/graph_transforms:summarize_graph' failed; build aborted: no such package '@local_config_git//': Traceback (most recent call last):
    File "/Users/my_user/external_projects/tensorflow/third_party/git/git_configure.bzl", line 61
        _fail(result.stderr)
    File "/Users/my_user/external_projects/tensorflow/third_party/git/git_configure.bzl", line 14, in _fail
        fail(("%sGit Configuration Error:%s %...)))
Git Configuration Error: Traceback (most recent call last):
  File "/private/var/tmp/_bazel_my_user/747948fb577123a5771581be02ddf56a/external/org_tensorflow/tensorflow/tools/git/gen_git_source.py", line 29, in <module>
    from builtins import bytes  # pylint: disable=redefined-builtin
ImportError: No module named builtins

INFO: Elapsed time: 0.501s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)

Env:

python --version
Python 3.6.5

System Version: macOS 10.14.5 (18F203)

2 个答案:

答案 0 :(得分:0)

运行./configure并设置python3的路径即可解决此问题。

答案 1 :(得分:0)

对于Windows:

安装MSYS2和其他库:https://www.tensorflow.org/install/source_windows

在安装MSYS2之后,您需要使用“ pacman -S git patch解压缩

来安装额外的库。

pacman.exe ”包含在 ./ msys64 / usr / bin 目录中。