Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation problems (TF bindings) #59

Open
nmiculinic opened this issue Dec 18, 2016 · 15 comments
Open

Installation problems (TF bindings) #59

nmiculinic opened this issue Dec 18, 2016 · 15 comments

Comments

@nmiculinic
Copy link

nmiculinic commented Dec 18, 2016

I'm trying to install tensorflow binding and have followed the steps:

cloned tf repo (without building it, tf is installed via pip)
Sucessfully installed package.
It fails on tests:

test_ctc_loss_op (unittest.loader._FailedTest) ... ERROR
test_warpctc_op (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: test_ctc_loss_op (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_ctc_loss_op
Traceback (most recent call last):
  File "/usr/lib/python3.5/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.5/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/tmp/warp-ctc/tensorflow_binding/tests/test_ctc_loss_op.py", line 23, in <module>
    import warpctc_tensorflow
  File "/tmp/warp-ctc/tensorflow_binding/warpctc_tensorflow/__init__.py", line 7, in <module>
    _warpctc = tf.load_op_library(lib_file)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 64, in load_op_library
    None, None, error_msg, error_code)
tensorflow.python.framework.errors_impl.NotFoundError: /tmp/warp-ctc/tensorflow_binding/warpctc_tensorflow/kernels.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZN10tensorflow7strings6StrCatB5cxx11ERKNS0_8AlphaNumE


======================================================================
ERROR: test_warpctc_op (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_warpctc_op
Traceback (most recent call last):
  File "/usr/lib/python3.5/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.5/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/tmp/warp-ctc/tensorflow_binding/tests/test_warpctc_op.py", line 3, in <module>
    from warpctc_tensorflow import ctc
  File "/tmp/warp-ctc/tensorflow_binding/warpctc_tensorflow/__init__.py", line 7, in <module>
    _warpctc = tf.load_op_library(lib_file)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 64, in load_op_library
    None, None, error_msg, error_code)
tensorflow.python.framework.errors_impl.NotFoundError: /tmp/warp-ctc/tensorflow_binding/warpctc_tensorflow/kernels.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZN10tensorflow7strings6StrCatB5cxx11ERKNS0_8AlphaNumE


----------------------------------------------------------------------
Ran 2 tests in 0.000s

FAILED (errors=2)
/t/w/tensorflow_binding »            

Ls of directory in question:

/t/w/tensorflow_binding » ls /tmp/warp-ctc/tensorflow_binding/warpctc_tensorflow      master ✔
__pycache__  __init__.py  kernels.cpython-35m-x86_64-linux-gnu.so
@nmiculinic nmiculinic changed the title Installation problems Installation problems (TF bindings) Dec 18, 2016
@nmiculinic
Copy link
Author

EDIT:

Tried with python2 and python3, and tried on two computers, (local one and workstation). Problem persists.

@chanil1218
Copy link

I faced same issue, and I found this link.
This error might comes from difference between gcc4 that your tensorflow binary built with and gcc5 your compilation environment for warp-ctc.

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")

Put this line into your CMakeLists.txt and just let me know it's work.

@nmiculinic
Copy link
Author

I manage to fix it by using what you recommended. (in CMakeList.txt and additionally in setup.py since there is also without that flag). If I use it within tensorflow code it works fine, however unit tests still fail with error:

CUDA_HOME not found in the environment so building without GPU support. To build with GPU support please define the CUDA_HOME environment variable. This should be a path which contains include/cuda.h
running test
running egg_info
writing top-level names to warpctc_tensorflow.egg-info/top_level.txt
writing warpctc_tensorflow.egg-info/PKG-INFO
writing dependency_links to warpctc_tensorflow.egg-info/dependency_links.txt
reading manifest file 'warpctc_tensorflow.egg-info/SOURCES.txt'
writing manifest file 'warpctc_tensorflow.egg-info/SOURCES.txt'
running build_ext
copying build/lib.linux-x86_64-3.5/warpctc_tensorflow/kernels.cpython-35m-x86_64-linux-gnu.so -> warpctc_tensorflow
CUDA_HOME not found in the environment so building without GPU support. To build with GPU support please define the CUDA_HOME environment variable. This should be a path which contains include/cuda.h
running test
running egg_info
writing top-level names to warpctc_tensorflow.egg-info/top_level.txt
writing warpctc_tensorflow.egg-info/PKG-INFO
writing dependency_links to warpctc_tensorflow.egg-info/dependency_links.txt
reading manifest file 'warpctc_tensorflow.egg-info/SOURCES.txt'
writing manifest file 'warpctc_tensorflow.egg-info/SOURCES.txt'
running build_ext
copying build/lib.linux-x86_64-3.5/warpctc_tensorflow/kernels.cpython-35m-x86_64-linux-gnu.so -> warpctc_tensorflow
testBasicCPU (test_ctc_loss_op.CTCLossTest) ... ok
testBasicGPU (test_ctc_loss_op.CTCLossTest) ... Skipping GPU test, no gpus available
ok
test_session (test_ctc_loss_op.CTCLossTest)
Returns a TensorFlow Session for use in executing tests. ... ok
test_basic_cpu (test_warpctc_op.WarpCTCTest) ... /home/lpp/Downloads/git/warp-ctc/tensorflow_binding/tests/test_warpctc_op.py:16: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(activations.shape, expected_gradients.shape)
ok
test_basic_gpu (test_warpctc_op.WarpCTCTest) ... Skipping GPU test, no gpus available
ok
test_multiple_batches_cpu (test_warpctc_op.WarpCTCTest) ... ok
test_multiple_batches_gpu (test_warpctc_op.WarpCTCTest) ... Skipping GPU test, no gpus available
ok
test_session (test_warpctc_op.WarpCTCTest)
Returns a TensorFlow Session for use in executing tests. ... ok

----------------------------------------------------------------------
Ran 8 tests in 0.120s

OK
test_ctc_loss_op (unittest.loader._FailedTest) ... ERROR
test_warpctc_op (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: test_ctc_loss_op (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_ctc_loss_op
Traceback (most recent call last):
  File "/usr/lib/python3.5/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.5/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/home/lpp/Downloads/git/warp-ctc/tensorflow_binding/tests/test_ctc_loss_op.py", line 23, in <module>
    import warpctc_tensorflow
  File "/home/lpp/Downloads/git/warp-ctc/tensorflow_binding/warpctc_tensorflow/__init__.py", line 47, in <module>
    @ops.RegisterGradient("WarpCTC")
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1495, in __call__
    _gradient_registry.register(f, self._op_type)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/registry.py", line 62, in register
    (self._name, name, function_name, filename, line_number))
KeyError: "Registering two gradient with name 'WarpCTC' !(Previous registration was in run_commands /usr/lib/python3.5/distutils/dist.py:955)"


======================================================================
ERROR: test_warpctc_op (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_warpctc_op
Traceback (most recent call last):
  File "/usr/lib/python3.5/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.5/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/home/lpp/Downloads/git/warp-ctc/tensorflow_binding/tests/test_warpctc_op.py", line 3, in <module>
    from warpctc_tensorflow import ctc
  File "/home/lpp/Downloads/git/warp-ctc/tensorflow_binding/warpctc_tensorflow/__init__.py", line 47, in <module>
    @ops.RegisterGradient("WarpCTC")
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1495, in __call__
    _gradient_registry.register(f, self._op_type)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/registry.py", line 62, in register
    (self._name, name, function_name, filename, line_number))
KeyError: "Registering two gradient with name 'WarpCTC' !(Previous registration was in run_commands /usr/lib/python3.5/distutils/dist.py:955)"


----------------------------------------------------------------------
Ran 2 tests in 0.000s

FAILED (errors=2)

@dylanbfox
Copy link

dylanbfox commented Feb 8, 2017

FWIW, I ran into this issue too. I just dropped down to Ubuntu 14.04 (from 16.04), and that solved this (and other) issues.

@bdaskalov
Copy link

I ran into the same problem, added the flag and submitted a pull request but nobody seems to be looking at it.
#73

@srilives
Copy link

Hi there,

We are also getting the same error as mentioned by nmiculinic. Is there is fix? if yes, please share. Thx

@megazone87
Copy link

@nmiculinic The same things happed to me. The unittest failed at the end, though the mid-process said the tests have been passed.

@bidai541
Copy link

The same error too.
add this line in setup.py in line 62
extra_compile_args += [ '-D_GLIBCXX_USE_CXX11_ABI=0']
add this line in CMakeFile.txt in line 8 :
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
(those two line means the same param may be only one could word!)
Delate the build and dist directory in warp-ctc/tensorflow_binding/
Then rebuild ; python setup.py install
This fixed!

@dgdn
Copy link

dgdn commented Aug 23, 2017

@bidai541 it did works!! thx

@fancyerii
Copy link

I face the same problem. When I add as bidai541 suggested, it seems to work. But When I run python setup.py test. it failed with:KeyError: "Registering two gradient with name 'WarpCTC' !(Previous registration was in run_commands /usr/lib/python3.5/distutils/dist.py:955)"

@hyichao
Copy link

hyichao commented Sep 23, 2017

@bidai541 It works and thanks for the solution. And by this I assume this error is caused by gcc5, therefore downgrading to Ubuntu14.04 works too in @dylanbfox 's case as gcc4 is installed in U14.04 meanwhile gcc5 is set as default in U16.04.
@fancyerii I assume setup.py test fails due to the script itself. You can still run your TF training code with warpctc correctly. In my case, there is a great acceleration.

@hookover
Copy link

@bidai541
i can't find the CMakeFile.txt file in warp-ctc dirctory and sub dircotry

@hookover
Copy link

@nmiculinic Have you solved this error? If yes, how to do that ?

@bidai541
Copy link

@hookover Root path, pull again!

@vankrelian
Copy link

I follow the guidelines above to change the compiler settings in both setup.py and CMakeLists.txt. However, it didn't change anything. I still have the same error when I run the tests:

NotFoundError: /home/ekonishi/warp-ctc/tensorflow_binding/warpctc_tensorflow/kernels.so: undefined symbol: _ZTIN10tensorflow8OpKernelE

Note that I've successfully compiled and installed tensorflow 1.4 in a virtual environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests