Serving: Extension file not found. Unable to load package for '@org_tensorflow//third_party/mkl:build_defs.bzl'

Created on 13 Jul 2017  路  4Comments  路  Source: tensorflow/serving

Here is what I did:

~/serving/tensorflow$ ./configure 
You have bazel 0.5.2 installed.
Please specify the location of python. [Default is /usr/bin/python]: /usr/local/anaconda3/bin/python
Found possible Python library paths:
  /usr/local/anaconda3/lib/python3.6/site-packages
Please input the desired Python library path to use.  Default is [/usr/local/anaconda3/lib/python3.6/site-packages]

Using python library path: /usr/local/anaconda3/lib/python3.6/site-packages
Do you wish to build TensorFlow with MKL support? [y/N] 
No MKL support will be enabled for TensorFlow
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -mcpu=native]: 
Do you wish to use jemalloc as the malloc implementation? [Y/n] 
jemalloc enabled
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] 
No Google Cloud Platform support will be enabled for TensorFlow
Do you wish to build TensorFlow with Hadoop File System support? [y/N] y
Hadoop File System support will be enabled for TensorFlow
Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N] y
XLA JIT support will be enabled for TensorFlow
Do you wish to build TensorFlow with VERBS support? [y/N] 
No VERBS support will be enabled for TensorFlow
Do you wish to build TensorFlow with OpenCL support? [y/N] y
OpenCL support will be enabled for TensorFlow
Do you wish to build TensorFlow with CUDA support? [y/N] y
CUDA support will be enabled for TensorFlow
Do you want to use clang as CUDA compiler? [y/N] 
nvcc will be used as CUDA compiler
Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to default to CUDA 8.0]: 
Please specify the location where CUDA  toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: 
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: 
Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 6.0]: 
Please specify the location where cuDNN  library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: 
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
Please note that each additional compute capability significantly increases your build time and binary size.
[Default is: "3.5,5.2"]: 
Please specify which C++ compiler should be used as the host C++ compiler. [Default is /usr/bin/g++]: 
Please specify which C compiler should be used as the host C compiler. [Default is /usr/bin/gcc]: 
Please specify the location where ComputeCpp for SYCL 1.2 is installed. [Default is /usr/local/computecpp]: 
Do you wish to build TensorFlow with MPI support? [y/N] y
MPI support will be enabled for TensorFlow
Please specify the MPI toolkit folder. [Default is /usr]: 
Configuration finished
~/serving/tensorflow$ cd ../
~/serving$ bazel build tensorflow_serving/...
ERROR: /home/ml/serving/tensorflow_serving/batching/test_util/BUILD:32:1: error loading package '@org_tensorflow//tensorflow/core': Extension file not found. Unable to load package for '@org_tensorflow//third_party/mkl:build_defs.bzl': BUILD file not found on package path and referenced by '//tensorflow_serving/batching/test_util:puppet_batch_scheduler_test'.
ERROR: /home/ml/serving/tensorflow_serving/batching/test_util/BUILD:32:1: error loading package '@org_tensorflow//tensorflow/core': Extension file not found. Unable to load package for '@org_tensorflow//third_party/mkl:build_defs.bzl': BUILD file not found on package path and referenced by '//tensorflow_serving/batching/test_util:puppet_batch_scheduler_test'.
ERROR: Analysis of target '//tensorflow_serving/batching/test_util:puppet_batch_scheduler_test' failed; build aborted.
INFO: Elapsed time: 1.650s
builinstall

Most helpful comment

After execute:

cd serving/
cp tensorflow/.bazelrc tensorflow/.tf_configure.bazelrc .

It works.

All 4 comments

I don't know how to solve this issue. Please help me.

Got the same error (altough for main tensorflow not serving) when running even the simplest bazel build //tensorflow/tools/pip_package:build_pip_package:

ERROR: error loading package 'tensorflow/tools/pip_package': Extension file not found. Unable to load package for '//third_party/mkl:build_defs.bzl': BUILD file not found on package path.

I remember I removed tensorflow/third-party/mkl/ directory, because I had circular symlink detected when running bazel. After looking with ls -la on mkl dir it looked that libdl.so.2 was the culprit, it was a symbolic link... to itself (don't know why). So I removed it, but had some more issues I don't remember, but ended up removing the whole mdl dir (hoped that ./configure will download it for me again). So I run ./configure, it fails, because it assumes that dir mkl exsits. So, I created that dir manually and run ./configure again. Then, some files were downloaded to mkl dir, however the OP error appeared. I think it's simply because there was no build_defs.bzl file in mkl dir.

So I just removed whole tensorflow dir, git cloned it again, run ./configure and then everything worked fine.

Hope this helps.

Thanks. Finally I solved this issue. I think I don't clone all the submodules.

git submodule update --recursive

And execute ./configure again.

But when I execute bazel build tensorflow_serving/..., it raised another error:

$ bazel build tensorflow_serving/...   
WARNING: /home/fengyu/.cache/bazel/_bazel_fengyu/49d694a6bdfd6ccee39cb10c46d42915/external/org_tensorflow/third_party/py/python_configure.bzl:30:3: Python Configuration Warning: 'PYTHON_LIB_PATH' environment variable is not set, using '/usr/local/lib/python2.7/dist-packages' as default.
ERROR: /home/fengyu/.cache/bazel/_bazel_fengyu/49d694a6bdfd6ccee39cb10c46d42915/external/org_tensorflow/third_party/py/numpy/BUILD:11:1: no such package '@local_config_python//': Traceback (most recent call last):
    File "/home/fengyu/.cache/bazel/_bazel_fengyu/49d694a6bdfd6ccee39cb10c46d42915/external/org_tensorflow/third_party/py/python_configure.bzl", line 310
        _create_local_python_repository(repository_ctx)
    File "/home/fengyu/.cache/bazel/_bazel_fengyu/49d694a6bdfd6ccee39cb10c46d42915/external/org_tensorflow/third_party/py/python_configure.bzl", line 274, in _create_local_python_repository
        _get_numpy_include(repository_ctx, python_bin)
    File "/home/fengyu/.cache/bazel/_bazel_fengyu/49d694a6bdfd6ccee39cb10c46d42915/external/org_tensorflow/third_party/py/python_configure.bzl", line 257, in _get_numpy_include
        _execute(repository_ctx, [python_bin, "-c",..."], <2 more arguments>)
    File "/home/fengyu/.cache/bazel/_bazel_fengyu/49d694a6bdfd6ccee39cb10c46d42915/external/org_tensorflow/third_party/py/python_configure.bzl", line 76, in _execute
        _python_configure_fail("\n".join([error_msg.strip() if ...", <2 more arguments>]))
    File "/home/fengyu/.cache/bazel/_bazel_fengyu/49d694a6bdfd6ccee39cb10c46d42915/external/org_tensorflow/third_party/py/python_configure.bzl", line 37, in _python_configure_fail
        fail("%sPython Configuration Error:%s...))
Python Configuration Error: Problem getting numpy include path.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named numpy
Is numpy installed?
 and referenced by '@org_tensorflow//third_party/py/numpy:headers'.
ERROR: Analysis of target '//tensorflow_serving/example:inception_export' failed; build aborted.
INFO: Elapsed time: 1.634s

The configure script is not working?

After execute:

cd serving/
cp tensorflow/.bazelrc tensorflow/.tf_configure.bazelrc .

It works.

Was this page helpful?
0 / 5 - 0 ratings