google/ml-metadata

Build from Docker broken due to Bazel version mismatch

bencwallace opened this issue · 2 comments

Following the current Installing with Docker instructions, as in

DOCKER_SERVICE=manylinux-python37
sudo docker-compose build ${DOCKER_SERVICE}
sudo docker-compose run ${DOCKER_SERVICE}

results in the following error on execution of the docker-compose run command (specifically, when "${PYTHON_BIN_PATH}" setup.py bdist_wheel is executed here):

+ /opt/python/cp37-cp37m/bin/python setup.py bdist_wheel
/opt/python/cp37-cp37m/lib/python3.7/site-packages/setuptools/dist.py:476: UserWarning: Normalizing '1.5.0.dev' to '1.5.0.dev0'
  normalized_version,
running bdist_wheel
running build
running bazel_build
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
ERROR: /build/ml_metadata/version_check.bzl:61:9: Traceback (most recent call last):
	File "/build/WORKSPACE", line 253
		check_bazel_version_at_least(<1 more arguments>)
	File "/build/ml_metadata/version_check.bzl", line 61, in check_bazel_version_at_least
		fail(<1 more arguments>)

Current Bazel version is 3.0.0- (@non-git), expected at least 3.7.2
ERROR: error loading package 'external': Package 'external' contains errors
INFO: Elapsed time: 20.434s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
Traceback (most recent call last):
  File "setup.py", line 173, in <module>
    'bazel_build': _BazelBuildCommand,
  File "/opt/python/cp37-cp37m/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/opt/python/cp37-cp37m/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/opt/python/cp37-cp37m/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/opt/python/cp37-cp37m/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/opt/python/cp37-cp37m/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 299, in run
    self.run_command('build')
  File "/opt/python/cp37-cp37m/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/opt/python/cp37-cp37m/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/opt/python/cp37-cp37m/lib/python3.7/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/opt/python/cp37-cp37m/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/opt/python/cp37-cp37m/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 107, in run
    cwd=os.path.dirname(os.path.realpath(__file__)),)
  File "/opt/python/cp37-cp37m/lib/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/bin/bazel', 'run', '--compilation_mode', 'opt', '--define', 'grpc_no_ares=true', '--verbose_failures', '//ml_metadata:move_generated_files']' returned non-zero exit status 1.

Indeed, it seems that the Bazel version shipped with the gcr.io/tfx-oss-public/manylinux2010-bazel image (used in this Dockerfile) is lower than that required in the WORKSPACE file.

This is likely easy to fix, but I'm not sure where to find an appropriate replacement for the manylinux image. Alternatively, maybe a Dockerfile more like the one used here would be better.

Hi Ben,

Thanks for bringing this to our notice! This is interesting as the gcr.io/tfx-oss-public/manylinux2010-bazel has a latest version of 4.0.0 as shown in [1]. It seems that the docker may somehow uses the 3.0.0 version instead of the latest one. I wonder what's your local Bazel version?

[1] https://pantheon.corp.google.com/gcr/images/tfx-oss-public/GLOBAL/manylinux2010-bazel

Strange, I was unable to reproduce this issue today. Not sure what happened. Sorry about that, you can close this.