Bazel: build command is only supported from with in a work space

Created on 4 Jan 2017  ·  8Comments  ·  Source: bazelbuild/bazel

Hello
I am trying to build GPU version of tensorflow and trying to flow a link described

https://alliseesolutions.wordpress.com/2016/07/05/how-to-install-gpu-tensorflow-0-9-from-sources-ubuntu-14-04/

coming to BUILD TENSORFLOW Module:
I tried using a command
bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

I get a response
The build command is only supported from within a workspace.

I trying to install this to work on CNN.
I am using ubuntu 14.0.4,

output of the command: bazel version
Build label: 0.4.3
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Dec 22 12:31:25 2016 (1482409885)
Build timestamp: 1482409885
Build timestamp as int: 1482409885

i guess without this i cannot use the tensorflow,
when i give source activate tensorflow it gives as (tensorflow)raady@pc:~
and when i try to run a file it gives Attribute error: module 'tensorflow' has no attribute ' InteractiveSession'

please provide the necessary help, thanks in advance.

Most helpful comment

I also meet this problem,
and I run the "touch WORKSPACE" command , the problem was resolved.

All 8 comments

Are you running bazel from tensorflow folder? It looks like bazel misses the WORKSPACE file.

I went to the tensorflow folder
and ran the same command, posting the error . I couldnt understand
while installing it asked for are you using openCL if selected y it asked for computecpp path as i didnt install i didnt choose them, do they are also required ?

bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
error
ERROR: /home/raady/.cache/bazel/_bazel_raady/f2c720f19f8d24a566b7f8f160524753/external/local_config_cuda/crosstool/BUILD:4:1: Traceback (most recent call last): File "/home/raady/.cache/bazel/_bazel_raady/f2c720f19f8d24a566b7f8f160524753/external/local_config_cuda/crosstool/BUILD", line 4 error_gpu_disabled() File "/home/raady/.cache/bazel/_bazel_raady/f2c720f19f8d24a566b7f8f160524753/external/local_config_cuda/crosstool/error_gpu_disabled.bzl", line 3, in error_gpu_disabled fail("ERROR: Building with --config=c...") ERROR: Building with --config=cuda but TensorFlow is not configured to build with GPU support. Please re-run ./configure and enter 'Y' at the prompt to build with GPU support. ERROR: no such target '@local_config_cuda//crosstool:toolchain': target 'toolchain' not declared in package 'crosstool' defined by /home/raady/.cache/bazel/_bazel_raady/f2c720f19f8d24a566b7f8f160524753/external/local_config_cuda/crosstool/BUILD

And I assume you tried running ./configure and entering 'Y' to enable GPU support? :)

Anyway, tensorflow is the right place to ask, so if you don't mind, I'll close this issue.

要先执行
git clone --recurse-submodules https://github.com/tensorflow/tensorflow,
并在源码的目录里执行如下:

创建 pip 包并安装

$ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package

$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

.whl 文件的实际名字与你所使用的平台有关

$ pip install /tmp/tensorflow_pkg/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

Did you run the configure step?
https://www.tensorflow.org/install/install_sources#ConfigureInstallation

On Fri, Jul 28, 2017 at 7:06 AM nanjizhiyin notifications@github.com
wrote:

要选择执行git clone --recurse-submodules
https://github.com/tensorflow/tensorflow,并在源码的目录里执行 .创建 pip 包并安装

$ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package

$ bazel-bin/tensorflow/tools/pip_package/build_pip_package
/tmp/tensorflow_pkg
.whl 文件的实际名字与你所使用的平台有关

$ pip install
/tmp/tensorflow_pkg/tensorflow-0.5.0-cp27-none-linux_x86_64.whl


You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub
https://github.com/bazelbuild/bazel/issues/2333#issuecomment-318560880,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAxt5qL1pPBqtDw5NYEaqovzh6Y6YIBfks5sSWxhgaJpZM4LaenM
.

>

--
Marcel Hlopko | Software Engineer | [email protected] |

Google Germany GmbH | Erika-Mann-Str. 33 | 80636 München | Germany |
Geschäftsführer: Matthew
Scott Sucherman, Paul Terence Manicle | Registergericht und -nummer:
Hamburg, HRB 86891

I also meet this problem,
and I run the "touch WORKSPACE" command , the problem was resolved.

bazel build -c opt //tensorflow/tools/pip_package:build_pip_package

it works! thx mate

Was this page helpful?
0 / 5 - 0 ratings