benley / bazel_rules_pex

Python PEX rules for Bazel
Apache License 2.0
39 stars 36 forks source link

Inconsistent Build Error: invalid command 'bdist_wheel' #73

Open zanes2016 opened 6 years ago

zanes2016 commented 6 years ago

Some builds will fail with the error below. It doesn't happen consistently and a simple rebuild (no bazel clean) will allow the build to succeed.

see full stacktrace at the bottom

stdout (abbreviation)

# bazel build launch
INFO: Analysed target //launch:launch (0 packages loaded).
INFO: Found 1 target...
ERROR: /Users/dev0/piran/launch/BUILD:11:1: PexPython launch/launch.pex failed (Exit 1)
**** Failed to install MarkupSafe-1.0 (caused by: NonZeroExit("received exit code 1 during execution of `['/usr/bin/python3.5', '-', 'bdist_wheel', '--dist-dir=/tmp/tmpb8t9gre6']` while trying to execute `['/usr/bin/python3.5', '-', 'bdist_wheel', '--dist-dir=/tmp/tmpb8t9gre6']`",)
):
stdout:

stderr:
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'bdist_wheel'
...

Environment

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:    16.04
Codename:   xenial

Version

# bazel version
Build label: 0.15.2
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jul 17 12:22:40 2018 (1531830160)
Build timestamp: 1531830160
Build timestamp as int: 1531830160

WORKSPACE

git_repository(
    name = "io_bazel_rules_pex",
    remote = "https://github.com/benley/bazel_rules_pex.git",
    commit = "7e6890ff5f806dcc3790b86e4acfed9ad3a82ee7",
)
load("@io_bazel_rules_pex//pex:pex_rules.bzl", "pex_repositories")
pex_repositories()

stdout

# bazel build launch
INFO: Analysed target //launch:launch (0 packages loaded).
INFO: Found 1 target...
ERROR: /Users/dev0/piran/launch/BUILD:11:1: PexPython launch/launch.pex failed (Exit 1)
**** Failed to install MarkupSafe-1.0 (caused by: NonZeroExit("received exit code 1 during execution of `['/usr/bin/python3.5', '-', 'bdist_wheel', '--dist-dir=/tmp/tmpb8t9gre6']` while trying to execute `['/usr/bin/python3.5', '-', 'bdist_wheel', '--dist-dir=/tmp/tmpb8t9gre6']`",)
):
stdout:

stderr:
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'bdist_wheel'

Traceback (most recent call last):
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/bazel-out/host/bin/external/io_bazel_rules_pex/pex/pex_wrapper.pex/.bootstrap/_pex/pex.py", line 365, in execute
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/bazel-out/host/bin/external/io_bazel_rules_pex/pex/pex_wrapper.pex/.bootstrap/_pex/pex.py", line 293, in _wrap_coverage
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/bazel-out/host/bin/external/io_bazel_rules_pex/pex/pex_wrapper.pex/.bootstrap/_pex/pex.py", line 325, in _wrap_profiling
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/bazel-out/host/bin/external/io_bazel_rules_pex/pex/pex_wrapper.pex/.bootstrap/_pex/pex.py", line 408, in _execute
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/bazel-out/host/bin/external/io_bazel_rules_pex/pex/pex_wrapper.pex/.bootstrap/_pex/pex.py", line 466, in execute_entry
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/bazel-out/host/bin/external/io_bazel_rules_pex/pex/pex_wrapper.pex/.bootstrap/_pex/pex.py", line 471, in execute_module
  File "/usr/lib/python3.5/runpy.py", line 199, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/.pex/install/pex_wrapper-0.1-py2.py3-none-any.whl.5bc6bd6d5f9c936df9fea2fffef5498fca89699d/pex_wrapper-0.1-py2.py3-none-any.whl/pex_wrapper.py", line 122, in <module>
    main()
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/.pex/install/pex_wrapper-0.1-py2.py3-none-any.whl.5bc6bd6d5f9c936df9fea2fffef5498fca89699d/pex_wrapper-0.1-py2.py3-none-any.whl/pex_wrapper.py", line 76, in main
    resolver_options_builder)
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/.pex/install/pex-1.2.13-py2.py3-none-any.whl.6bfeb70d4c4280954ddc331c1f3a49cad35a567d/pex-1.2.13-py2.py3-none-any.whl/pex/bin/pex.py", line 571, in build_pex
    for dist in resolveds:
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/.pex/install/pex-1.2.13-py2.py3-none-any.whl.6bfeb70d4c4280954ddc331c1f3a49cad35a567d/pex-1.2.13-py2.py3-none-any.whl/pex/resolver.py", line 438, in resolve_multi
    allow_prereleases):
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/.pex/install/pex-1.2.13-py2.py3-none-any.whl.6bfeb70d4c4280954ddc331c1f3a49cad35a567d/pex-1.2.13-py2.py3-none-any.whl/pex/resolver.py", line 376, in resolve
    return resolver.resolve(resolvables_from_iterable(requirements, builder))
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/.pex/install/pex-1.2.13-py2.py3-none-any.whl.6bfeb70d4c4280954ddc331c1f3a49cad35a567d/pex-1.2.13-py2.py3-none-any.whl/pex/resolver.py", line 209, in resolve
    dist = self.build(package, resolvable.options)
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/.pex/install/pex-1.2.13-py2.py3-none-any.whl.6bfeb70d4c4280954ddc331c1f3a49cad35a567d/pex-1.2.13-py2.py3-none-any.whl/pex/resolver.py", line 282, in build
    dist = super(CachingResolver, self).build(package, options)
  File "/root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/.pex/install/pex-1.2.13-py2.py3-none-any.whl.6bfeb70d4c4280954ddc331c1f3a49cad35a567d/pex-1.2.13-py2.py3-none-any.whl/pex/resolver.py", line 177, in build
    raise Untranslateable('Package %s is not translateable by %s' % (package, translator))
pex.resolver.Untranslateable: Package SourcePackage('file:///root/.cache/bazel/_bazel_root/6f6133ece88806ce1513398e26791cf1/sandbox/processwrapper-sandbox/1/execroot/__main__/.pex/build/MarkupSafe-1.0.tar.gz') is not translateable by ChainedTranslator(WheelTranslator, EggTranslator, SourceTranslator)
Target //launch:launch failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 23.637s, Critical Path: 23.09s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
nicknezis commented 4 years ago

I also had this issue on a different project using similar rules. Ended up having to apt-get install python-wheel or python3-wheel