NotFoundError for import tensorflow_decision_forests as tfdf

My code was working on Colab, but today it got following error.
My tfdf installation is successfully:
!pip install tensorflow_decision_forests

It is the import statement got error:
import tensorflow_decision_forests as tfdf
here is the error message:

NotFoundError Traceback (most recent call last)
in ()
6 import matplotlib.pyplot as plt
7 import tensorflow as tf
----> 8 import tensorflow_decision_forests as tfdf
9 from keras import backend as K
10 from sklearn.model_selection import train_test_split


5 frames


/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/load_library.py in load_op_library(library_filename)
56 RuntimeError: when unable to load the library or get the python wrappers.
57 “”"
—> 58 lib_handle = py_tf.TF_LoadLibrary(library_filename)
59 try:
60 wrappers = _pywrap_python_op_gen.GetPythonWrappers(

NotFoundError: /usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/tensorflow/ops/training/training.so: undefined symbol: _ZN10tensorflow11GetNodeAttrERKNS_9AttrSliceEN4absl14lts_2020_09_2311string_viewEPSs

Any idea?

We had an issue with TF 2.6 and there’s a fix in the works.

If you use with TF 2.5 it will work fine until the fix lands

2 Likes

Then I got Keras error:

ImportError Traceback (most recent call last)
in ()
7 import tensorflow as tf
8 import tensorflow_decision_forests as tfdf
----> 9 from keras import backend as K
10 from sklearn.model_selection import train_test_split
11 from IPython.core.magic import register_line_magic

4 frames
/usr/local/lib/python3.7/dist-packages/keras/layers/init.py in ()
146
147 # Normalization layers.
→ 148 from keras.layers.normalization import LayerNormalization
149 from keras.layers.normalization_v2 import SyncBatchNormalization
150

ImportError: cannot import name ‘LayerNormalization’ from ‘keras.layers.normalization’ (/usr/local/lib/python3.7/dist-packages/keras/layers/normalization/init.py)

I think I got to wait. Thanks!

Yes, I guess it’s better. I’m sorry!
I’m also waiting!

Hi,

The _ZN10tensorflow11GetNodeAttrERKNS_9AttrSliceEN4absl14lts_2020_09_2311string_viewEPSs error was caused by a change in ABI in between TF2.5 and TF2.6 not yet reflected in TF-DF.

The last version of TF-DF (v0.1.9; released on 31 August 2021) solves this issue.

Ps: For future reference, such errors can generally be solved by finding and installing the corresponding version of TF and TF-DF :).

1 Like