models icon indicating copy to clipboard operation
models copied to clipboard

Error importing Tensorflow

Open wongalvis opened this issue 9 years ago • 10 comments

I pointed the directory of parser_eval and conll2tree to /home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/ to solve issues like "line 55: bazel-bin/syntaxnet/conll2tree: No such file or directory"

Now I get this

~$ echo 'Bob brought the pizza to Alice.' | models/syntaxnet/syntaxnet/demo.sh Traceback (most recent call last): File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/parser_eval.runfiles/main/syntaxnet/parser_eval.py", line 23, in import tensorflow as tf File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/parser_eval.runfiles/org_tensorflow/tensorflow/init.py", line 24, in from tensorflow.python import * File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/parser_eval.runfiles/org_tensorflow/tensorflow/python/init.py", line 60, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/parser_eval.runfiles/org_tensorflow/tensorflow/python/init.py", line 49, in from tensorflow.python import pywrap_tensorflow ImportError: cannot import name pywrap_tensorflow

Error importing tensorflow. Unless you are using bazel, you should not try to import tensorflow from its source directory; please exit the tensorflow source tree, and relaunch your python interpreter from there. Traceback (most recent call last): File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/parser_eval.runfiles/main/syntaxnet/parser_eval.py", line 23, in import tensorflow as tf File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/parser_eval.runfiles/org_tensorflow/tensorflow/init.py", line 24, in from tensorflow.python import * File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/parser_eval.runfiles/org_tensorflow/tensorflow/python/init.py", line 60, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/parser_eval.runfiles/org_tensorflow/tensorflow/python/init.py", line 49, in from tensorflow.python import pywrap_tensorflow ImportError: cannot import name pywrap_tensorflow

Error importing tensorflow. Unless you are using bazel, you should not try to import tensorflow from its source directory; please exit the tensorflow source tree, and relaunch your python interpreter from there. Traceback (most recent call last): File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/conll2tree.runfiles/main/syntaxnet/conll2tree.py", line 21, in import tensorflow as tf File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/conll2tree.runfiles/org_tensorflow/tensorflow/init.py", line 24, in from tensorflow.python import * File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/conll2tree.runfiles/org_tensorflow/tensorflow/python/init.py", line 60, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "/home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/conll2tree.runfiles/org_tensorflow/tensorflow/python/init.py", line 49, in from tensorflow.python import pywrap_tensorflow ImportError: cannot import name pywrap_tensorflow

Error importing tensorflow. Unless you are using bazel, you should not try to import tensorflow from its source directory; please exit the tensorflow source tree, and relaunch your python interpreter from there.

wongalvis avatar Feb 18 '17 19:02 wongalvis

What platform are you running on?

aselle avatar Feb 19 '17 05:02 aselle

@aselle Ubuntu 14.04.5 LTS

wongalvis avatar Feb 20 '17 04:02 wongalvis

@wongalvis What version of TensorFlow are you using?

Also, can you describe exactly what you did when you said: "I pointed the directory of parser_eval and conll2tree to /home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/ to solve issues like "line 55: bazel-bin/syntaxnet/conll2tree: No such file or directory"

That sounds like the root problem, but I'm not sure exactly what you did.

tatatodd avatar Mar 01 '17 06:03 tatatodd

I cloned tensorflow @ 950db43

It's been a while and I forgot the exact steps I've taken and the respective output. But I do rmb I encountered two problems, the "No such file" and "Error importing TF". I cd to ~ to avoid "importing tensorflow from its source directory". After encountering the "No such file" problem, I googled and found someone posting a solution by correcting the directories to conll2tree and parser_eval to /home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/ where they exist.

Thank you.

wongalvis avatar Mar 02 '17 04:03 wongalvis

@wongalvis Are you still encountering a problem? If not I'll close this out, and you can file a new issue when you're trying things out again.

tatatodd avatar Mar 03 '17 03:03 tatatodd

Yes this problem persists, correcting the directories is what I've done before encountering "Error importing TF" even if I'm in ~/

wongalvis avatar Mar 03 '17 19:03 wongalvis

I pointed the directory of parser_eval and conll2tree to /home/pwmvx1289/.cache/bazel/_bazel_pwmvx1289/f1c99cb5624c89408f4ae4a44b3c0d38/execroot/syntaxnet/bazel-out/local-opt/bin/syntaxnet/ to solve issues like "line 55: bazel-bin/syntaxnet/conll2tree: No such file or directory"

Could you please explain why you are doing this? (It seems very strange to me that you should need to be pointing any program at a bazel build cache rather than a bazel-bin directory)

I'm guessing that you're following this tutorial? https://github.com/tensorflow/models/tree/master/syntaxnet#installation ...but I don't see any steps including the binaries you mention

prb12 avatar Mar 06 '17 22:03 prb12

It gave error like "line 55: bazel-bin/syntaxnet/conll2tree: No such file or directory" when I'm running the demo script.

wongalvis avatar Mar 06 '17 23:03 wongalvis

@calberti Could you please add some information about how these tools binraies are expected to be found by the scripts?

prb12 avatar Mar 07 '17 22:03 prb12

Automatically closing due to lack of recent activity. Since this issue is old at this point, please reopen the issue if it still occurs when tried with the latest version of Tensorflow. Thank you.

karmel avatar Feb 22 '18 19:02 karmel