When building tensorflow
from sources with bazel
I have got error:
io_bazel_rules_go/go/private/sdk.bzl:337:12: name 'json' is not defined
How to add the dependency or import json
library?
The code looks like python source, so I have tried to import json
, which does not work.
git clone https://github.com/tensorflow/tensorflow.git
PYTHON_VERSION=python3.10
PYTHON_BIN_PATH=$(which $PYTHON_VERSION) \
PYTHON_LIB_PATH=$($PYTHON_VERSION -c "import pip; print(pip.__path__[0].rstrip('/pip'))") \
TF_NEED_CUDA=0 \
TF_NEED_ROCM=0 \
TF_DOWNLOAD_CLANG=0 \
CC_OPT_FLAGS="-march=native -Wno-sign-compare -mnoavx" \
TF_SET_ANDROID_WORKSPACE=0 \
TF_ENABLE_XLA=1 \
TF_NEED_OPENCL_SYCL=0 \
TF_NEED_MPI=0 \
./configure
bazel build
My environment:
Ubuntu 22.04 LTS (all installed packages are up-to-date)
bazel 3.5.1- (@non-git)
tensorflow branch r2.11
As stated above, 3.5 is too old.
sudo dpkg -P bazel-bootstrap
sudo npm install -g @bazel/bazelisk