text: Error while importing Tensorflow-text: undefined symbol

Tensorflow-text: 2.9.0 Tensorflow: 2.9.1 Python: 3.7.13

Happen only with 2.9.0 2.10.0b2 and 2.8.2rc1 seems to be working.

In Google Collab.

Similar to closed #325 two years ago.

import tensorflow_text as text
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[<ipython-input-30-40513338c6fc>](https://localhost:8080/#) in <module>()
      1 import tensorflow_hub as hub
      2 import pandas as pd
----> 3 import tensorflow_text as text
      4 import matplotlib.pyplot as plt
      5 from sklearn.model_selection import train_test_split

[/usr/local/lib/python3.7/dist-packages/tensorflow_text/__init__.py](https://localhost:8080/#) in <module>()
     18 

     19 # pylint: disable=wildcard-import
---> 20 from tensorflow_text.core.pybinds import tflite_registrar
     21 from tensorflow_text.python import keras
     22 from tensorflow_text.python import metrics

ImportError: /usr/local/lib/python3.7/dist-packages/tensorflow_text/core/pybinds/tflite_registrar.so: undefined symbol: _ZN4absl12lts_2021110220raw_logging_internal21internal_log_functionB5cxx11E

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Do you have an example colab? When I try this using one of the guides (and editing it to use tensorflow_text==2.9.*) I don’t have the same issue. https://colab.research.google.com/github/tensorflow/text/blob/master/docs/guide/tokenizers.ipynb#scrollTo=ISEUjIsYAl2S

What I think may be happening is that you are importing tensorflow before pip installing tensorflow_text. That loads TF libs in colab that are incompatible with tf text 2.9.x. The default TF of Colab is 2.8.2 at the moment, which would explain why TF Text 2.8.x (and 2.10 beta) work because they are built to work with TF 2.8.x, so Colab does not need to pip install a new version of TF.

If you disconnect the runtime, connect again, and pip install tensorflow_text with the first code block, do you receive the same error?