tensorflow / decision-forests

A collection of state-of-the-art algorithms for the training, serving and interpretation of Decision Forest models in Keras.
Apache License 2.0
663 stars 110 forks source link

TFDF won't load on Google Colab #8

Closed ssequeira closed 3 years ago

ssequeira commented 3 years ago

I can't install TFDF on Google Colab. The minimum working example I've made is here, and the first cell where I install and load the library fails.

The error is

NotFoundError                             Traceback (most recent call last)
<ipython-input-5-4f2d5416ffd4> in <module>()
      1 get_ipython().system('pip install tensorflow_decision_forests')
      2 import tensorflow as tf
----> 3 import tensorflow_decision_forests as tfdf

/usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/__init__.py in <module>()
     49 __author__ = "Mathieu Guillame-Bert"
     50 
---> 51 from tensorflow_decision_forests import keras
     52 from tensorflow_decision_forests.component import py_tree
     53 from tensorflow_decision_forests.component.builder import builder

/usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/keras/__init__.py in <module>()
     47 from typing import Callable, List
     48 
---> 49 from tensorflow_decision_forests.keras import core
     50 from tensorflow_decision_forests.keras import wrappers
     51 

/usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/keras/core.py in <module>()
     58 from tensorflow.python.training.tracking import base as base_tracking  # pylint: disable=g-direct-tensorflow-import
     59 from tensorflow_decision_forests.component.inspector import inspector as inspector_lib
---> 60 from tensorflow_decision_forests.tensorflow import core as tf_core
     61 from tensorflow_decision_forests.tensorflow.ops.inference import api as tf_op
     62 from tensorflow_decision_forests.tensorflow.ops.training import op as training_op

/usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/tensorflow/core.py in <module>()
     29 import tensorflow as tf
     30 
---> 31 from tensorflow_decision_forests.tensorflow.ops.training import api as training_op
     32 from yggdrasil_decision_forests.dataset import data_spec_pb2
     33 from yggdrasil_decision_forests.learner import abstract_learner_pb2

/usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/tensorflow/ops/training/api.py in <module>()
     22 from tensorflow.python.framework import load_library
     23 from tensorflow.python.platform import resource_loader
---> 24 tf.load_op_library(resource_loader.get_path_to_datafile("training.so"))

/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/load_library.py in load_op_library(library_filename)
     55   Raises:
     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:

NotFoundError: /usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/tensorflow/ops/training/training.so: undefined symbol: _ZN10tensorflow14kernel_factory17OpKernelRegistrar12InitInternalEPKNS_9KernelDefEN4absl14lts_2020_09_2311string_viewESt10unique_ptrINS0_15OpKernelFactoryESt14default_deleteIS9_EE
achoum commented 3 years ago

Thanks for the report.

It is likely due to the Absl ABI incompatibility that was introduced in tf2.5.0rc2 and solved in tf2.5.0rc3.

Restart the colab runtime (Menu > Runtime > Restart runtime) and try again. This should hopefully solve this issue.