Models: word2vec error : tensorflow.python.framework.errors_impl.NotFoundError: /root/project/embed/tf/optimized/word2vec_ops.so: undefined symbol: _ZTIN10tensorflow8OpKernelE

Created on 6 Dec 2017  路  13Comments  路  Source: tensorflow/models

I ran the word2vec example and got the error.

Environment:
(1) centos7
(2) python3
(3) cpu

Any solution for this problem? Thank you in advance!

Most helpful comment

Hi all, could you try again with the latest version of the README? We just merged a change to the compile instructions in https://github.com/tensorflow/models/pull/3099.

All 13 comments

I also get the same error when trying to run word2vec_optimized.py with a g++ built word2vec_ops.so. Attempting to use tensorflow binaries from both pip installed tensorflow-gpu, and building from source with branch r1.4 (in separate virtualenvs).

Environment:

  • Ubuntu 16.04
  • Python 3.5.2
  • g++ 5.4.0

TF from source build command:

$ bazel build --config=opt --config=cuda --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" //tensorflow/tools/pip_package:build_pip_package

word2vec build & run commands:

$ echo $TF_INC
/ai/tensorflow.ai/env3/lib/python3.5/site-packages/tensorflow/include
$ g++ -std=c++11 -shared word2vec_ops.cc word2vec_kernels.cc -o word2vec_ops.so -fPIC -I $TF_INC -O2 -D_GLIBCXX_USE_CXX11_ABI=0



md5-93f1cedadbca5a5c463ad39ed837fe15



$ ls -a
.   __init__.py  questions-words.txt  text8                word2vec_ops.cc  word2vec_optimized.py       word2vec.py
..  output       README.md            word2vec_kernels.cc  word2vec_ops.so  word2vec_optimized_test.py  word2vec_test.py



md5-93f1cedadbca5a5c463ad39ed837fe15



$ python3 word2vec_optimized.py --train_data=text8 --eval_data=questions-words.txt --save_path=output/
Traceback (most recent call last):
  File "word2vec_optimized.py", line 44, in <module>
    word2vec = tf.load_op_library(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'word2vec_ops.so'))
  File "/ai/tensorflow.ai/env3_tf_from_src/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 56, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename, status)
  File "/ai/tensorflow.ai/env3_tf_from_src/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: /ai/tensorflow.ai/models/tutorials/embedding/word2vec_ops.so: undefined symbol: _ZTIN10tensorflow8OpKernelE

Please advise!

Building word2vec_ops.so without the -D_GLIBCXX_USE_CXX11_ABI=0 flag makes no difference either, same error.

@nealwu @drpngx Any updates or insights on this issue? I'm currently blocked. Thanks

I can reproduce this inside the official tensorflow docker image with version 1.4.1. My workaround was to use the 1.2.1 docker image which works fine. I did not try 1.3.

Actually, the current version should be 1.5.x. Couldyou try that?

Are you using the monolithic build or the split out build?

FYI I tried as well during debugging tensorflow/tensorflow#15002

I can confirm:

TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
TF_NSYNC=$HOME/.local/lib/python2.7/site-packages/tensorflow/include/external/nsync/public
TF_LIB=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')
g++ -std=c++11 -shared word2vec_ops.cc word2vec_kernels.cc -o word2vec_ops.so -fPIC -I $TF_INC -O2 -D_GLIBCXX_USE_CXX11_ABI=0 -I $TF_NSYNC -L$TF_LIB -ltensorflow_framework

is working on the master branch (commit 4cb0c13c7779da536cac6c682180c5757611b384) of TensorFlow

Hi all, could you try again with the latest version of the README? We just merged a change to the compile instructions in https://github.com/tensorflow/models/pull/3099.

@nealwu can confirm the new instructions work (after leaving out the -D_GLIBCXX_USE_CXX11_ABI=0 because I compiled from source).

relevant specs I can think of:
ubuntu 16.04, 64 bit, anaconda python 3.6.4, tensorflow 1.4.0, gcc 7.2.0

I'm still having the same problem described above! Can't run any of the python scripts.

Hi @joaodafonseca, what problem are you having exactly? Did you run the new instructions at https://github.com/tensorflow/models/tree/master/tutorials/embedding?

Hi @nealwu, yes I did follow the new instructions and having the following errors:

Traceback (most recent call last): File "word2vec_optimized.py", line 44, in <module> word2vec = tf.load_op_library(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'word2vec_ops.so')) File "/Users/joaofonseca/tensorflow/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/load_library.py", line 56, in load_op_library lib_handle = py_tf.TF_LoadLibrary(library_filename, status) File "/Users/joaofonseca/tensorflow/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__ c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.NotFoundError: dlopen(/Users/joaofonseca/tensorflow/tensorflow/tensorflow/models/tutorials/embedding/word2vec_ops.so, 6): image not found

Hi @joaodafonseca, that's a different error from what everyone here was experiencing. It looks like you might have a problem with your Python and/or TensorFlow installation. I recommend asking on StackOverflow for advice.

Closing this issue in the meantime since the original issue has been resolved.

Was this page helpful?
0 / 5 - 0 ratings