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

import fails: "undefined symbol: _ZN10tensorflow12OpDefBuilder4AttrESs" #192

Closed
moreymat opened this issue Nov 29, 2019 · 19 comments
Closed

Comments

@moreymat
Copy link

I encountered this bug which is most probably a duplicate of #30 that has been closed.
Is it related to #160 (comment) ?

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): no
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 18.04 LTS
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: no
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 2.0.0
  • Python version: Anaconda python 3.7.5
  • CUDA/cuDNN version: None
  • GPU model and memory: None

Describe the current behavior
Error on importing tensorflow-text making it impossible to be imported.

Describe the expected behavior
Library can be effortlessly imported and used.

Code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate the problem.

I created a new minimal environment using

conda create -n tf-test tensorflow python=3.7
conda activate tf-test
pip install tensorflow-text

then, when trying to import tensorflow_text the following error appears

$ python
Python 3.7.5 (default, Oct 25 2019, 15:51:11) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> import tensorflow_text as text
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mathieu/miniconda3/envs/tf-test/lib/python3.7/site-packages/tensorflow_text/__init__.py", line 21, in <module>
    from tensorflow_text.python import metrics
  File "/home/mathieu/miniconda3/envs/tf-test/lib/python3.7/site-packages/tensorflow_text/python/metrics/__init__.py", line 20, in <module>
    from tensorflow_text.python.metrics.text_similarity_metric_ops import *
  File "/home/mathieu/miniconda3/envs/tf-test/lib/python3.7/site-packages/tensorflow_text/python/metrics/text_similarity_metric_ops.py", line 28, in <module>
    gen_text_similarity_metric_ops = load_library.load_op_library(resource_loader.get_path_to_datafile('_text_similarity_metric_ops.so'))
  File "/home/mathieu/miniconda3/envs/tf-test/lib/python3.7/site-packages/tensorflow_core/python/framework/load_library.py", line 61, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /home/mathieu/miniconda3/envs/tf-test/lib/python3.7/site-packages/tensorflow_text/python/metrics/_text_similarity_metric_ops.so: undefined symbol: _ZN10tensorflow12OpDefBuilder4AttrESs
@broken
Copy link
Member

broken commented Dec 9, 2019

This looks like a conda issue. If you don't create the conda environment with tensorflow in the beginning it works fine.

conda create -n tf-test python=3.7
conda activate tf-test
pip install tensorflow
pip install tensorflow-text

Do you know what is different about installing it at creation vs using pip after?

@broken
Copy link
Member

broken commented Jan 6, 2020

This is a month old and doesn't appear like a tf text issue, so I'm closing.

@broken broken closed this as completed Jan 6, 2020
@moreymat
Copy link
Author

moreymat commented Jan 7, 2020

Sorry I could not reply earlier then lost sight of your answer.
This works :

pip install tensorflow
pip install tensorflow-text

but this does not :

conda install tensorflow
pip install tensorflow-text

Could it be an issue with the conda recipe for tensorflow ?

@elliotvilhelm
Copy link

Same issue here using conda installed tensorflow 2.0.0 and tensorflow-text==2.0.0

@shailensobhee
Copy link

This is a month old and doesn't appear like a tf text issue, so I'm closing.

This doesn't look like a legit reason to close a ticket.

@soumayan
Copy link

soumayan commented May 5, 2020

same issue-
pip install tensorflow-gpu==2.2.0rc1
pip install tensorflow-text==2.2.0rc1
import tensorflow_text

NotFoundError: /opt/conda/lib/python3.6/site-packages/tensorflow_text/python/metrics/_text_similarity_metric_ops.so: undefined symbol: _ZN10tensorflow8OpKernel11TraceStringEPNS_15OpKernelContextEb

@zzj0402
Copy link

zzj0402 commented May 8, 2020

Same issue in Kaggle notebook. This issue is needed and not resolved. Poor task management.

@soumayan
Copy link

soumayan commented May 8, 2020

@zzj0402 install tensorflow 2.0 in kaggle notebook,then this problem will be removed

@karllessard
Copy link

If that can help, I work in TensorFlow Java and and just tried to load directly the _wordpiece_tokenizer.so library extracted from TF-Text 2.2.0 python wheels and link it with libtensorflow_framework.so.2 that we distribute (which is built now from TF 2.2.0). I got the same error as @soumayan , who had to downgrade to TF2.0.0 if I understand correctly:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/karl/_wordpiece_tokenizer.so: undefined symbol: _ZN10tensorflow8OpKernel11TraceStringEPNS_15OpKernelContextEb

So it looks like there might be an incompatibility between TF 2.2.0 and TF-Text 2.2.0

@zzj0402
Copy link

zzj0402 commented May 15, 2020

@zzj0402 install tensorflow 2.0 in kaggle notebook,then this problem will be removed

I solved it by toggle GPU on in Kaggle environment settings.

@phihung
Copy link

phihung commented Jun 15, 2020

Similar issue in Mac OSX with tensorflow and tensorflow_text installed with pip inside conda env.

import tensorflow as tf  # OK 2.2.0
import tensorflow_text as text

NotFoundError: dlopen(/miniconda3/envs/tf/lib/python3.7/site-packages/tensorflow_text/python/ops/_normalize_ops.dylib, 6): Symbol not found: ____chkstk_darwin
  Referenced from: /miniconda3/envs/tf/lib/python3.7/site-packages/tensorflow_text/python/ops/_normalize_ops.dylib (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libSystem.B.dylib
 in /miniconda3/envs/tf/lib/python3.7/site-packages/tensorflow_text/python/ops/_normalize_ops.dylib 

@mikkotuomela
Copy link

I have this same problem. tensorflow gets imported without problems, importing tensorflow-text results in op's error message.

tensorflow is built from sources (1.15.3), tensorflow-text is stock binary (1.15.1, tried also 1.15.0rc0).
Platform is Ubuntu 18.04.3 LTS. Python 3.6.9. Using (Mini)conda environment.

tensorflow is built without GPU support and tensorflow-gpu is not installed.

Could there still be a compatibility issue? Interestingly, people seem to have exact same issue with TF 2 as well, but here I am using version 1.15.

Any help or ideas would be greatly appreciated.

@snehankekre
Copy link

I saw the same error on Colab. The solution was that the tensorflow-text version needs to match the tf version. Since Colab was using tensorflow==2.2.0, I was successfully able to install and import tensorflow-text after:
!pip install tensorflow-text==2.2.0

@parthlathiya2697
Copy link

Solved:
I was performing tensorflow object detection training and encountered this type of error. It got resolved when I installed tensorflow version 2.1.0, above versions still has that error

@adenilso
Copy link

I saw the same error on Colab. The solution was that the tensorflow-text version needs to match the tf version. Since Colab was using tensorflow==2.2.0, I was successfully able to install and import tensorflow-text after:
!pip install tensorflow-text==2.2.0

Thank you! I worked for me.

@nershman
Copy link

nershman commented Jan 5, 2022

Changing tensorflow version just gives me a different error... Symbol not found: ____chkstk_darwin

In my case I believe the issue is due to new releases being built on OSX 10.15, info here

@broken
Copy link
Member

broken commented Jan 10, 2022

Nobody monitors closed issues, so I doubt anybody on the team has noticed any of these replies. If anybody on this thread is having a problem, please create a new issue with the error, tf version, tf text version, os, and if you are using an environment like conda or pyenv.

@oksanatkach
Copy link

oksanatkach commented Oct 13, 2022

I got this error on Google Colab.

After hours of struggle, I am 99% this is some sort of a VM memory or path issue. It looks like you are using a library of one version (if you run pip list), but it's actually a different version.

To fix this, completely disconnect and delete the runtime. If you don't do this, I think some stuff in the memory persists forever, even if you close Colab. Then, when you switch to GPU, you will get a GPU environment with tensorflow version 2.9 installed and no tensorflow-text installed. Separately run pip install with versions specified:

pip install tensorflow==2.10
pip install tensorflow-text==2.10

This works.

If you try to run tensorflow v 2.10 with tensorflow-text v 2.9, you get this error too. This is why I believe it's some sort of pip installation memory issue?

Makes sense that tensorflow don't want to solve this, as it is likely just the Google Colab VM problem.

@pras135
Copy link

pras135 commented Aug 9, 2023

this worked for me
!pip install -U tensorflow
!pip install -U tensorflow-text
as mentioned here https://stackoverflow.com/a/72964778/5238639

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