Closed Tomas0413 closed 7 years ago
Please provide details about what platform you are using (operating system, architecture). Also include your TensorFlow version. We ask for this in the issue submission template, because it is really difficult to help without that information. Thanks!
@concretevitamin sorry, should have added it straight away!
OS / arch:
Ubuntu 16.04.2 LTS \n \l
Linux hostname 4.4.0-63-generic #84-Ubuntu SMP Wed Feb 1 17:20:32 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
This works in general and shows TF version:
# python -c 'import tensorflow as tf; print(tf.__version__)'
1.0.1
However if I run the same command from /data/models/syntaxnet/tensorflow (/data/models is where I have https://github.com/tensorflow/models.git cloned) directory, I get this error:
# python -c 'import tensorflow as tf; print(tf.__version__)'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named pywrap_tensorflow_internal
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Also bazel version is 0.4.5 (I see in Dockerfile 0.4.3 is being used, maybe this is a problem)
.............
Build label: 0.4.5
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Mar 16 12:19:38 2017 (1489666778)
Build timestamp: 1489666778
Build timestamp as int: 1489666778
Does this SO answer help? http://stackoverflow.com/questions/35953210/error-running-basic-tensorflow-example
@concretevitamin I don't think my case is the same as it's described in SO mentioned above. I have no problem installing the TF 1.0.1 using pip and then using it. All this works and also upgrade worked for both Python 2.x and Python 3.x. My problem is with tensorflow within syntaxnet.
@calberti can you take a look at this? (I assigned to you based on the SyntaxNet README, feel free to reassign)
I have the exact same problem as @Tomas0413 describes. Running echo "Hello" | syntaxnet/demo.sh
returns the pywrap error.
I'm using macOS Sierra 10.12.3 and Python 2.7.13. Bazel 0.4.5-homebrew. Tensorflow 1.0.1.
Steps to reproduce for me:
mkvirtualenv tensorflow-models
git clone https://github.com/tensorflow/models.git --recursive
cd models/syntaxnet/tensorflow
pip install numpy
./configure (accept all the defaults)
cd ..
bazel build
chmod +x syntaxnet/demo.sh
echo "Hello" | syntaxnet/demo.sh
...
ImportError: No module named pywrap_tensorflow_internal (as above)
Given @Tomas0413 suggestion about using the wrong bazel version I tried installing 0.4.3, but I get the exact same error with that version too.
I got it to work! It seems you need to run bazel test
and wait for it to complete, and during that process (~30 min wait time) the pywrap_tensorflow_internal module magically appears.
@EmilStenstrom I'm glad it worked for you. I ran "bazel test ..." and then I still got the error. I'll try to clone the repository again in case the problem is fixed now.
@EmilStenstrom works for me now as well. I can see there were few changes since I opened this issue.
# git pull
remote: Counting objects: 331, done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 331 (delta 179), reused 173 (delta 173), pack-reused 125
Receiving objects: 100% (331/331), 147.70 KiB | 0 bytes/s, done.
Resolving deltas: 100% (206/206), completed with 118 local objects.
From https://github.com/tensorflow/models
73ae53a..40a5739 master -> origin/master
* [new branch] inception-readme -> origin/inception-readme
* [new branch] textsum-python3 -> origin/textsum-python3
Fetching submodule syntaxnet/tensorflow
remote: Counting objects: 3749, done.
remote: Total 3749 (delta 2126), reused 2126 (delta 2126), pack-reused 1623
Receiving objects: 100% (3749/3749), 1.51 MiB | 1.78 MiB/s, done.
Resolving deltas: 100% (2947/2947), completed with 822 local objects.
From https://github.com/tensorflow/tensorflow
d1415bd..0799c7f master -> origin/master
* [new branch] r1.1 -> origin/r1.1
* [new tag] v1.1.0-rc0 -> v1.1.0-rc0
Updating 73ae53a..40a5739
Fast-forward
autoencoder/AdditiveGaussianNoiseAutoencoderRunner.py | 7 +-
autoencoder/AutoencoderRunner.py | 7 +-
autoencoder/MaskingNoiseAutoencoderRunner.py | 7 +-
autoencoder/Utils.py | 9 -
autoencoder/VariationalAutoencoderRunner.py | 7 +-
autoencoder/autoencoder_models/Autoencoder.py | 7 +-
autoencoder/autoencoder_models/DenoisingAutoencoder.py | 17 +-
autoencoder/autoencoder_models/VariationalAutoencoder.py | 7 +-
im2txt/README.md | 12 +-
inception/README.md | 32 +--
inception/inception/data/build_image_data.py | 7 +-
inception/inception/slim/README.md | 2 +-
resnet/resnet_model.py | 2 +-
skip_thoughts/README.md | 26 +--
street/README.md | 2 -
syntaxnet/dragnn/components/stateless/BUILD | 34 +++
syntaxnet/dragnn/components/stateless/stateless_component.cc | 131 +++++++++++
syntaxnet/dragnn/components/stateless/stateless_component_test.cc | 171 ++++++++++++++
syntaxnet/dragnn/components/syntaxnet/BUILD | 19 +-
syntaxnet/dragnn/components/syntaxnet/syntaxnet_component.cc | 15 ++
syntaxnet/dragnn/components/syntaxnet/syntaxnet_component.h | 15 ++
syntaxnet/dragnn/components/syntaxnet/syntaxnet_component_test.cc | 109 ++++++++-
syntaxnet/dragnn/components/syntaxnet/syntaxnet_link_feature_extractor.cc | 15 ++
syntaxnet/dragnn/components/syntaxnet/syntaxnet_link_feature_extractor.h | 15 ++
syntaxnet/dragnn/components/syntaxnet/syntaxnet_link_feature_extractor_test.cc | 15 ++
syntaxnet/dragnn/components/syntaxnet/syntaxnet_transition_state.cc | 15 ++
syntaxnet/dragnn/components/syntaxnet/syntaxnet_transition_state.h | 15 ++
syntaxnet/dragnn/components/syntaxnet/syntaxnet_transition_state_test.cc | 15 ++
syntaxnet/dragnn/components/util/BUILD | 7 +-
syntaxnet/dragnn/components/util/bulk_feature_extractor.h | 15 ++
syntaxnet/dragnn/core/BUILD | 55 ++---
syntaxnet/dragnn/core/beam.h | 20 +-
syntaxnet/dragnn/core/beam_test.cc | 15 ++
syntaxnet/dragnn/core/component_registry.cc | 15 ++
syntaxnet/dragnn/core/component_registry.h | 15 ++
syntaxnet/dragnn/core/compute_session.h | 15 ++
syntaxnet/dragnn/core/compute_session_impl.cc | 15 ++
syntaxnet/dragnn/core/compute_session_impl.h | 15 ++
syntaxnet/dragnn/core/compute_session_impl_test.cc | 15 ++
syntaxnet/dragnn/core/compute_session_pool.cc | 15 ++
syntaxnet/dragnn/core/compute_session_pool.h | 15 ++
syntaxnet/dragnn/core/compute_session_pool_test.cc | 15 ++
syntaxnet/dragnn/core/index_translator.cc | 15 ++
syntaxnet/dragnn/core/index_translator.h | 15 ++
syntaxnet/dragnn/core/index_translator_test.cc | 15 ++
syntaxnet/dragnn/core/input_batch_cache.h | 25 ++-
syntaxnet/dragnn/core/input_batch_cache_test.cc | 15 ++
syntaxnet/dragnn/core/interfaces/BUILD | 5 +-
syntaxnet/dragnn/core/interfaces/cloneable_transition_state.h | 15 ++
syntaxnet/dragnn/core/interfaces/component.h | 15 ++
syntaxnet/dragnn/core/interfaces/input_batch.h | 15 ++
syntaxnet/dragnn/core/interfaces/transition_state.h | 15 ++
syntaxnet/dragnn/core/interfaces/transition_state_starter_test.cc | 15 ++
syntaxnet/dragnn/core/ops/compute_session_op.cc | 15 ++
syntaxnet/dragnn/core/ops/compute_session_op.h | 15 ++
syntaxnet/dragnn/core/ops/dragnn_bulk_op_kernels.cc | 15 ++
syntaxnet/dragnn/core/ops/dragnn_bulk_op_kernels_test.cc | 15 ++
syntaxnet/dragnn/core/ops/dragnn_bulk_ops.cc | 25 ++-
syntaxnet/dragnn/core/ops/dragnn_op_kernels.cc | 15 ++
syntaxnet/dragnn/core/ops/dragnn_op_kernels_test.cc | 15 ++
syntaxnet/dragnn/core/ops/dragnn_ops.cc | 21 ++
syntaxnet/dragnn/core/resource_container.h | 15 ++
syntaxnet/dragnn/core/resource_container_test.cc | 15 ++
syntaxnet/dragnn/core/test/BUILD | 13 +-
syntaxnet/dragnn/core/test/generic.cc | 15 ++
syntaxnet/dragnn/core/test/generic.h | 15 ++
syntaxnet/dragnn/core/test/mock_component.h | 15 ++
syntaxnet/dragnn/core/test/mock_compute_session.h | 15 ++
syntaxnet/dragnn/core/test/mock_transition_state.h | 15 ++
syntaxnet/dragnn/io/sentence_input_batch.cc | 15 ++
syntaxnet/dragnn/io/sentence_input_batch.h | 15 ++
syntaxnet/dragnn/io/sentence_input_batch_test.cc | 15 ++
syntaxnet/dragnn/io/syntaxnet_sentence.h | 15 ++
syntaxnet/dragnn/python/BUILD | 1 +
syntaxnet/dragnn/python/biaffine_units.py | 29 ++-
syntaxnet/dragnn/python/bulk_component.py | 21 +-
syntaxnet/dragnn/python/bulk_component_test.py | 15 ++
syntaxnet/dragnn/python/component.py | 46 +++-
syntaxnet/dragnn/python/composite_optimizer.py | 15 ++
syntaxnet/dragnn/python/composite_optimizer_test.py | 18 +-
syntaxnet/dragnn/python/digraph_ops.py | 15 ++
syntaxnet/dragnn/python/digraph_ops_test.py | 15 ++
syntaxnet/dragnn/python/dragnn_ops.py | 15 ++
syntaxnet/dragnn/python/graph_builder.py | 76 ++++---
syntaxnet/dragnn/python/graph_builder_test.py | 32 +++
syntaxnet/dragnn/python/network_units.py | 81 +++----
syntaxnet/dragnn/python/network_units_test.py | 15 ++
syntaxnet/dragnn/python/render_parse_tree_graphviz.py | 15 ++
syntaxnet/dragnn/python/render_parse_tree_graphviz_test.py | 15 ++
syntaxnet/dragnn/python/render_spec_with_graphviz.py | 15 ++
syntaxnet/dragnn/python/render_spec_with_graphviz_test.py | 15 ++
syntaxnet/dragnn/python/sentence_io.py | 15 ++
syntaxnet/dragnn/python/sentence_io_test.py | 15 ++
syntaxnet/dragnn/python/spec_builder.py | 8 +-
syntaxnet/dragnn/python/trainer_lib.py | 19 +-
syntaxnet/dragnn/python/visualization.py | 15 ++
syntaxnet/dragnn/python/visualization_test.py | 15 ++
syntaxnet/dragnn/python/wrapped_units.py | 58 +++--
syntaxnet/dragnn/tools/BUILD | 39 +++-
syntaxnet/dragnn/tools/build_pip_package.py | 15 ++
syntaxnet/dragnn/tools/evaluator.py | 21 ++
syntaxnet/dragnn/tools/model_trainer.py | 197 ++++++++++++++++
syntaxnet/dragnn/tools/model_trainer_test.sh | 54 +++++
syntaxnet/dragnn/tools/oss_notebook_launcher.py | 15 ++
syntaxnet/dragnn/tools/parse-to-conll.py | 15 ++
syntaxnet/dragnn/tools/parser_trainer.py | 1 -
syntaxnet/dragnn/tools/segmenter-evaluator.py | 15 ++
syntaxnet/dragnn/tools/testdata/biaffine.model/config.txt | 4 +
syntaxnet/dragnn/tools/testdata/biaffine.model/hyperparameters.pbtxt | 18 ++
syntaxnet/dragnn/tools/testdata/biaffine.model/master.pbtxt | 1135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
syntaxnet/dragnn/tools/testdata/biaffine.model/resources/category-map | 7 +
syntaxnet/dragnn/tools/testdata/biaffine.model/resources/char-map | 18 ++
syntaxnet/dragnn/tools/testdata/biaffine.model/resources/char-ngram-map | 46 ++++
syntaxnet/dragnn/tools/testdata/biaffine.model/resources/label-map | 8 +
syntaxnet/dragnn/tools/testdata/biaffine.model/resources/lcword-map | 11 +
syntaxnet/dragnn/tools/testdata/biaffine.model/resources/prefix-table | Bin 0 -> 345 bytes
syntaxnet/dragnn/tools/testdata/biaffine.model/resources/suffix-table | Bin 0 -> 327 bytes
syntaxnet/dragnn/tools/testdata/biaffine.model/resources/tag-map | 8 +
syntaxnet/dragnn/tools/testdata/biaffine.model/resources/tag-to-category | 7 +
syntaxnet/dragnn/tools/testdata/biaffine.model/resources/word-map | 11 +
syntaxnet/dragnn/tools/testdata/biaffine.model/targets.pbtxt | 17 ++
syntaxnet/dragnn/tools/testdata/small.conll | 29 +++
syntaxnet/dragnn/viz/compile-minified.sh | 14 ++
syntaxnet/dragnn/viz/develop.sh | 14 ++
syntaxnet/g3doc/universal.md | 4 +-
syntaxnet/syntaxnet/BUILD | 10 +-
syntaxnet/syntaxnet/graph_builder.py | 6 +-
syntaxnet/syntaxnet/ops/parser_ops.cc | 9 +
syntaxnet/syntaxnet/reader_ops.cc | 19 +-
syntaxnet/syntaxnet/reader_ops_test.py | 48 +++-
syntaxnet/tensorflow | 2 +-
textsum/seq2seq_attention_model.py | 5 +-
transformer/cluttered_mnist.py | 2 +-
tutorials/README.md | 2 +-
tutorials/rnn/ptb/ptb_word_lm.py | 2 +-
tutorials/rnn/translate/seq2seq_model.py | 4 +-
136 files changed, 3604 insertions(+), 288 deletions(-)
delete mode 100644 autoencoder/Utils.py
create mode 100644 syntaxnet/dragnn/components/stateless/BUILD
create mode 100644 syntaxnet/dragnn/components/stateless/stateless_component.cc
create mode 100644 syntaxnet/dragnn/components/stateless/stateless_component_test.cc
create mode 100755 syntaxnet/dragnn/tools/model_trainer.py
create mode 100755 syntaxnet/dragnn/tools/model_trainer_test.sh
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/config.txt
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/hyperparameters.pbtxt
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/master.pbtxt
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/resources/category-map
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/resources/char-map
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/resources/char-ngram-map
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/resources/label-map
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/resources/lcword-map
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/resources/prefix-table
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/resources/suffix-table
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/resources/tag-map
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/resources/tag-to-category
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/resources/word-map
create mode 100644 syntaxnet/dragnn/tools/testdata/biaffine.model/targets.pbtxt
create mode 100644 syntaxnet/dragnn/tools/testdata/small.conll
I got this error until I left the tensorflow directory.
That is, I typed:
cd
to change directory to my home directory
@mkarliner "left the tensorflow directory" what doest it mean? i still got error
I got the following error while running "bazel test ..." Can anyone help me to solve this. I just clone the repo yesterday.
//syntaxnet:parser_features_test PASSED in 0.2s //syntaxnet:parser_trainer_test PASSED in 72.7s //syntaxnet:reader_ops_test PASSED in 19.6s //syntaxnet:segmenter_utils_test PASSED in 0.1s //syntaxnet:sentence_features_test PASSED in 0.1s //syntaxnet:shared_store_test PASSED in 0.6s //syntaxnet:tagger_transitions_test PASSED in 0.1s //syntaxnet:text_formats_test PASSED in 10.0s //syntaxnet/util:check_test PASSED in 8.4s //syntaxnet/util:registry_test PASSED in 9.4s //syntaxnet:whole_sentence_features_test PASSED in 0.1s //util/utf8:unicodetext_unittest PASSED in 0.0s //dragnn/python:graph_builder_test FAILED in 1 out of 2 in 232.5s /home/mentis/.cache/bazel/_bazel_mentis/f0b92031d8dd4c40876c8502b4c32e81/execroot/syntaxnet/ba zel-out/local-opt/testlogs/dragnn/python/graph_builder_test/test.log //dragnn/python:visualization_test FAILED in 1 out of 2 in 2.8s /home/mentis/.cache/bazel/_bazel_mentis/f0b92031d8dd4c40876c8502b4c32e81/execroot/syntaxnet/ba zel-out/local-opt/testlogs/dragnn/python/visualization_test/test.log //examples/dragnn:test_run_all_tutorials FAILED in 1 out of 2 in 15.6s /home/mentis/.cache/bazel/_bazel_mentis/f0b92031d8dd4c40876c8502b4c32e81/execroot/syntaxnet/ba zel-out/local-opt/testlogs/examples/dragnn/test_run_all_tutorials/test.log
Executed 52 out of 52 tests: 49 tests pass and 3 fail locally. There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings comman d line option to see which ones these are.
@mkarliner This worked, thanks!
@diahnuri Meaning, change your current directory to something other than the directory where you have cloned the tensorflow repository. For example, if you are at ~/githubRepos/tensorflow and have installed tensorflow from source, change your directory to, say, home : cd
, or to the parent directory: cd ..
, and then launch python
and import tensorflow as tf
in it.
(info)
I was facing this issue on Ubuntu 16.10, Bazel 0.4.5, when trying to compile from source to get the additional CPU instruction sets support, Python 2.7.3, Tensorflow 1.1.0, gcc 6.1.1. cd
to different directory didn't help; bazel clean
and bazel test
and bazel test ...
all didn't improve anything. If you're in the same boat, instead of pulling your hair out, here's a link to a Wheel that just works, courtesy @Zhomart
https://github.com/yaroslavvb/tensorflow-community-wheels/issues/15
Download what's linked above, pip uninstall
whatever broken version of tensorflow
you've progressed to, and then pip install $DOWNLOADS/tensorflow-1.0.1-cp27-cp27mu-linux_x86_64.whl
I haven't extensively tested yet but it runs and doesnt throw the missing set Warnings so i'm happy :+1:
@diahnuri bu diah sya juga dapat error yang sama tapi pas udah cd ke direktori lain anehnya jadi bisa gak tau kenapa haaha
I am on Mac OS Sierra (with no GPU support) and I had
Failed to load the native TensorFlow runtime.
error being thrown by bazel test because I am using a pyenv (python virtual environment) for my tensorflow libs but bazel tries to use the system python (as opposed to trying to use the tensorflowVIrtualEnv python) when running tests. I can get the tests to pass by adding this to the bazel test command:
-python2_path="~/.pyenv/versions/tensorflowVirtualEnv/bin/python"
I am using python2 because syntaxnet seems to only support python2. My final test command, which I run from "...models/syntaxnet" directory is:
bazel test --python2_path="/Users/YOUR_USER_NAME/.pyenv/versions/YOUR_PYENV_NAME/bin/python" --linkopt=-headerpad_max_install_names --nocache_test_results dragnn/... syntaxnet/... util/utf8/...
Same thing, in my case it worked leaving the directory. In the shell you are working, you are of course inside the directory that u cloned from Github, the directory where u ran ./configure. If u try to run python from that directory and then import tensorflow, it fails. If you live that directory and then run python, it works flawlessly
Yes, run from any other directory and the "import tensorflow" works fine. Thanks guys :)
if you're not using miniconda to handle pip stuff - I can't recommend it enough https://gist.github.com/johndpope/187b0dd996d16152ace2f842d43e3990
so was getting this same error - ran this conda env export name: tensorflow channels:
then ran this to upgrade tensorflow
conda install -c conda-forge tensorflow
Fetching package metadata ........... Solving package specifications: .
Package plan for installation in environment /Users/jpope/miniconda2/envs/tensorflow:
The following NEW packages will be INSTALLED:
backports.weakref: 1.0rc1-py35_0 conda-forge
libgpuarray: 0.7.1-0 conda-forge
mako: 1.0.7-py35_0 conda-forge
markdown: 2.6.9-py35_0
pygpu: 0.7.1-np113py35_0 conda-forge
theano: 0.9.0-py35_1 conda-forge
webencodings: 0.5-py35_0 conda-forge
The following packages will be UPDATED:
html5lib: 0.999-py35_0 --> 0.9999999-py35_0 conda-forge
tensorflow: 1.0.0-py35_0 conda-forge --> 1.3.0-py35_0 conda-forge
The following packages will be DOWNGRADED:
keras: 2.0.2-py35_1 conda-forge --> 1.0.7-py35_0 conda-forge
Proceed ([y]/n)?
libgpuarray-0. 100% |################################################################################################################################| Time: 0:00:00 3.43 MB/s backports.weak 100% |################################################################################################################################| Time: 0:00:00 7.04 MB/s markdown-2.6.9 100% |################################################################################################################################| Time: 0:00:00 2.86 MB/s webencodings-0 100% |################################################################################################################################| Time: 0:00:00 8.25 MB/s html5lib-0.999 100% |################################################################################################################################| Time: 0:00:00 976.33 kB/s mako-1.0.7-py3 100% |################################################################################################################################| Time: 0:00:00 2.35 MB/s pygpu-0.7.1-np 100% |################################################################################################################################| Time: 0:00:01 491.46 kB/s theano-0.9.0-p 100% |################################################################################################################################| Time: 0:00:01 3.45 MB/s tensorflow-1.3 100% |################################################################################################################################| Time: 0:00:04 8.48 MB/s keras-1.0.7-py 100% |################################################################################################################################| Time: 0:00:00 1.94 MB/s
all good.
Thank you @johndpope. This fixed it for me.
Still im getting this issue after installing dll file
change directory, it's so amazing
i am also see the same issue, you can try pip install tf-nightly,run you code,i can not see the issue
SyntaxNet
Hello, I'm running this:
And then I get this:
I'm using these options to configure Tensorflow (also tried with XLA and without XLA support):