Repository navigation
Syntax Error on bazel build #27
Copy link
Copy link
Closed
Description
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Fedora 31
- TensorFlow installed from (source or binary): source
- TensorFlow version (use command below): your latest git version
- Python version: 3.7.5
- Bazel version (if compiling from source): 0.16.0
- GCC/Compiler version (if compiling from source): 9.2.1
- CUDA/cuDNN version: none
- GPU model and memory: Intel
- Exact command to reproduce:
bazel build --verbose_failures --jobs=6 --config=sycl --config=opt //tensorflow/tools/pip_package:build_pip_package
Describe the problem
I try to build with SYSCL support following https://developer.codeplay.com/products/computecpp/ce/guides/tensorflow-guide/tensorflow-native-compilation, it fails
Source code / logs
$ bazel build --verbose_failures --jobs=6 --config=sycl --config=opt //tensorflow/tools/pip_package:build_pip_package
WARNING: /home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/grpc/BUILD:1960:1: in srcs attribute of cc_library rule @grpc//:grpc_nanopb: please do not import '@grpc//third_party/nanopb:pb_common.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/grpc/BUILD:1960:1: in srcs attribute of cc_library rule @grpc//:grpc_nanopb: please do not import '@grpc//third_party/nanopb:pb_decode.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/grpc/BUILD:1960:1: in srcs attribute of cc_library rule @grpc//:grpc_nanopb: please do not import '@grpc//third_party/nanopb:pb_encode.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /home/pafer/Projects/TfOpenCL/tensorflow/tensorflow/contrib/learn/BUILD:17:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:exporter': No longer supported. Switch to SavedModel immediately.
WARNING: /home/pafer/Projects/TfOpenCL/tensorflow/tensorflow/contrib/learn/BUILD:17:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:gc': No longer supported. Switch to SavedModel immediately.
INFO: Analysed target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded).
INFO: Found 1 target...
ERROR: /home/pafer/Projects/TfOpenCL/tensorflow/tensorflow/python/BUILD:5199:1: Executing genrule //tensorflow/python:framework/fast_tensor_util.pyx_cython_translation failed (Exit 1): bash failed: error executing command
(cd /home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/execroot/org_tensorflow && \
exec env - \
LD_LIBRARY_PATH=/home/pafer/Projects/TfOpenCL/ComputeCpp-CE-1.3.0-CentOS-x86_64/lib \
PATH=/home/pafer/bin:/home/pafer/.nvm/versions/node/v12.10.0/bin:/home/pafer/Envs/google-cloud-sdk/bin:/home/pafer/.local/bin:/home/pafer/bin:/home/pafer/.local/bin:/home/pafer/bin:/usr/share/Modules/bin:/usr/condabin:/home/pafer/.go/path/go-1.13/bin:/home/pafer/.go/root/go-1.13/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin \
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; PYTHONHASHSEED=0 bazel-out/host/bin/external/cython/cython_binary --cplus tensorflow/python/framework/fast_tensor_util.pyx --output-file bazel-out/host/genfiles/tensorflow/python/framework/fast_tensor_util.cpp')
Traceback (most recent call last):
File "/home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/execroot/org_tensorflow/bazel-out/host/bin/external/cython/cython_binary.runfiles/cython/cython.py", line 17, in <module>
main(command_line = 1)
File "/home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/cython/Cython/Compiler/Main.py", line 720, in main
result = compile(sources, options)
File "/home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/cython/Cython/Compiler/Main.py", line 695, in compile
return compile_multiple(source, options)
File "/home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/cython/Cython/Compiler/Main.py", line 666, in compile_multiple
context = options.create_context()
File "/home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/cython/Cython/Compiler/Main.py", line 590, in create_context
self.cplus, self.language_level, options=self)
File "/home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/cython/Cython/Compiler/Main.py", line 75, in __init__
from . import Builtin, CythonScope
File "/home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/cython/Cython/Compiler/CythonScope.py", line 5, in <module>
from .UtilityCode import CythonUtilityCode
File "/home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/cython/Cython/Compiler/UtilityCode.py", line 3, in <module>
from .TreeFragment import parse_from_strings, StringParseContext
File "/home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/cython/Cython/Compiler/TreeFragment.py", line 17, in <module>
from .Visitor import VisitorTransform
File "/home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/cython/Cython/Compiler/Visitor.py", line 15, in <module>
from . import ExprNodes
File "/home/pafer/.cache/bazel/_bazel_pafer/e35f46a077ab640c6c436e2e9faf4c45/external/cython/Cython/Compiler/ExprNodes.py", line 2875
await = None
^
SyntaxError: invalid syntax
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 0.714s, Critical Path: 0.28s
INFO: 3 processes: 3 local.
FAILED: Build did NOT complete successfully
My bazel config:
$ cat .tf_configure.bazelrc
build --action_env PYTHON_BIN_PATH="/usr/bin/python"
build --action_env PYTHON_LIB_PATH="/usr/lib64/python3.7/site-packages"
build --python_path="/usr/bin/python"
build --define with_jemalloc=true
build:gcp --define with_gcp_support=true
build:hdfs --define with_hdfs_support=true
build:s3 --define with_s3_support=true
build:kafka --define with_kafka_support=true
build:xla --define with_xla_support=true
build:gdr --define with_gdr_support=true
build:verbs --define with_verbs_support=true
build --action_env TF_NEED_OPENCL_SYCL="1"
build:sycl --copt=-DINTEL_GPU=1
build --action_env TF_SYCL_PLATFORM="INTEL_GPU"
build --action_env TF_SYCL_USE_HALF="0"
build:sycl --cxxopt=-DTENSORFLOW_SYCL_NO_HALF=1
build --action_env TF_SYCL_USE_DOUBLE="1"
build --action_env TF_SYCL_USE_LOCAL_MEM="1"
build:sycl --cxxopt=-DEIGEN_SYCL_LOCAL_MEM
build --action_env TF_SYCL_USE_SERIAL_MEMOP="0"
build:sycl --cxxopt=-no-serial-memop
build --action_env TF_SYCL_IMGDNN_DIR=""
build --action_env TF_SYCL_USE_TENSOROPT="0"
build --action_env COMPUTECPP_TOOLKIT_PATH="/home/pafer/Projects/TfOpenCL/ComputeCpp-CE-1.3.0-CentOS-x86_64"
build --action_env TF_SYCL_OFFLINE_COMPILER=""
build --action_env TF_SYCL_OFFLINE_COMPILER_ARGS=""
build:sycl --cxxopt=-fsycl-split-modules=20
build --action_env TF_SYCL_BITCODE_TARGET="spir64"
build:sycl --define using_trisycl=false
build --action_env TF_NEED_CUDA="0"
build --action_env TF_DOWNLOAD_CLANG="0"
build --define grpc_no_ares=true
build:opt --copt=-march=native
build:opt --host_copt=-march=native
build:opt --define with_default_optimizations=true
build:opt --strip=always
Regards,
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
Rbiessy commentedon Feb 3, 2020
The issue comes from the Python version used, we only support Python 3.5 for now. If you can use 3.5 then downgrading is the easiest way.
If you want to try with 3.7 then I suggest you bump the Cython version to 0.29 (as suggested here):
3732784c45cfb040a5b0936951d196f83a12ea17by443369fc35ac35525eb4241548cad79d0c94f8dcin thistf_http_archivesha256field by the correctsha256sumof the tarball (or an empty string), in this case6dcd30b5ceb887b2b965ee7ceb82ea3acb5f0642fe2206c7636b45acea4798e5->e49631f8f2eb8910b4b341e883d29db16b83d11b71bee04ca853c113c2cb5612This may bring more issues which I could help with if needed.
metal3d commentedon Feb 4, 2020
Thanks, I'm trying. I'll give you some news in a couple of hours (bazel is not fast at all...)
metal3d commentedon Feb 4, 2020
Right, it goes further, but failed :)
Don't know if I should open a new issue, or leave it like that and check when it will be possible to compile with Python 3.7.x
Thanks for your help
Rbiessy commentedon Feb 5, 2020
Thank you for trying it :)
So this is now hitting this issue: grpc/grpc#18950
Similarly we would need to bump grpc to 1.24 by replacing in tensorflow/workspace.bzl:
d184fa229d75d336aedea0041bd59cb93e7e267f->2de2e8dd8921e1f7d043e01faf7fe8a291fbb072895b31310e718a61f7335759a778c068a6edde1c089883598a0830cbb7075673->c396cabdf18650a61c0ecb171fec8bae6580f686b52558f59f410809bdbe0baeI'm happy to keep this issue open to discuss on how to enable support for Python 3.7. I may give it a go myself at some point so that we have an experimental branch for 3.7.
metal3d commentedon Feb 6, 2020
Ok, I will try today (I'm a bit busy for a couple of hours)
Thanks for your help
Rbiessy commentedon Jun 30, 2020
My experiments suggest that it will be to difficult to cherry pick the right changes. The only solution is to bump the fork to at least TF 1.11 which is not planned at the moment.
ShreyasheeSinha commentedon Nov 9, 2021
I am trying to build tensorflow on bazel 0.5.4 and bump into this error. I am running this on an ubuntu 16.04 instance. Python version is 3.6.3 and Cython is 0.29. Any idea how to go about this?
rodburns commentedon Nov 10, 2021
@ShreyasheeSinha what target are you building for? Are you using the SYCL build option listed in the original report in this issue? If not then I would raise a new issue with the information about how you are trying to build TensorFlow.