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

Undefined symbol when importing tensorflow #19331

Closed
jplu opened this issue May 16, 2018 · 5 comments

Comments

Projects
None yet
5 participants
@jplu
Copy link

commented May 16, 2018

System information

  • OS Platform and Distribution: Linux Ubuntu 18.04
  • TensorFlow installed from: usual pip install
  • TensorFlow version: 1.8.0
  • Python version: 3.6.5
  • Exact command to reproduce: python -c "import tensorflow"

Describe the problem

I'm installing Tensorflow CPU version via the usual pip command:

pip install tensorflow

And when I try to import tensorflow I get the following error message:

Traceback (most recent call last):
  File "/home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/usr/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: /home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow34_CallableOptions_default_instance_E

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/jplu/.local/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/usr/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: /home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow34_CallableOptions_default_instance_E


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.
[1]    15355 segmentation fault (core dumped)  python -c "import tensorflow"

Any idea of what is going wrong?

@tensorflowbutler

This comment has been minimized.

Copy link
Member

commented May 17, 2018

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
Have I written custom code
Bazel version
CUDA/cuDNN version
GPU model and memory

@asimshankar

This comment has been minimized.

Copy link
Contributor

commented May 17, 2018

Something seems incorrect with the installation, that error would make sense if the shared library is from an older version.

Could you try uninstalling and re-installing first?

pip3 uninstall tensorflow tensorflow-gpu
pip3 install tensorflow

And if that doesn't help, could you run the following:

md5sum /home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
md5sum /home/jplu/.local/lib/python3.6/site-packages/tensorflow/libtensorflow_framework.sh
ldd /home/jplu/.local/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so

That might give some clue as to what is messed up about the installation. Not quite sure how it ended up in this state.

@jplu

This comment has been minimized.

Copy link
Author

commented May 17, 2018

Ok, indeed it was refering to a wrong version of libtensorflow_framework.so. I have the Go framework installed with the C backend in 1.7.0, and when I have updated the python package through pip the link was done with the wrong version.

I did update the Go version and the C backend to 1.8.0 and now it works like a charm :)

Thanks a lot!!!

@jplu jplu closed this May 17, 2018

@abhanjac

This comment has been minimized.

Copy link

commented Dec 14, 2018

Hi jplu,

I am trying to install tensorflow on Odroid XU4. It got installed using bazel. But now while importing, I am having an error like your's. Can you be more specific about how you solved it.

The detailed error message is the following:

import tensorflow
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/tensorflow/init.py", line 24, in
from tensorflow.python import * # pylint: disable=redefined-builtin
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/init.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE

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.

@warp1337

This comment has been minimized.

Copy link

commented Dec 28, 2018

Hi jplu,

I am trying to install tensorflow on Odroid XU4. It got installed using bazel. But now while importing, I am having an error like your's. Can you be more specific about how you solved it.

The detailed error message is the following:

import tensorflow
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/tensorflow/init.py", line 24, in
from tensorflow.python import * # pylint: disable=redefined-builtin
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/init.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE

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.

I have exactly the same issue using 1.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.