I’m trying to import tensorflow_decision_forests in python like this:
import tensorflow_decision_forests as tfdf
And I keep getting the error I’ve included below. My tensorflow version is 2.11.0 and my tensorflow_decision_forests version is 1.2.0 so those should be compatible. I also am using Python version 3.10.11 and my macOS is version 10.14.5, so all of that should be fine. I tried uninstalling and installing tensorflow and tensorflow_decision_forests as well as downgrading to previous compatible versions of tensorflow and tensorflow_decision_forests and nothing has worked. Does anyone know whats going on? Here is the error:
NotFoundError Traceback (most recent call last)
Cell In[1], line 12
10 from scipy.stats import boxcox
11 import tensorflow as tf
—> 12 import tensorflow_decision_forests as tfdf
13 import pandas as pd
15 train_data = pd.read_csv(“train_housing.csv”)
File /anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow_decision_forests/init.py:64
60 from tensorflow_decision_forests.tensorflow import check_version
62 check_version.check_version(version, compatible_tf_versions)
—> 64 from tensorflow_decision_forests import keras
65 from tensorflow_decision_forests.component import py_tree
66 from tensorflow_decision_forests.component.builder import builder
File /anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow_decision_forests/keras/init.py:53
15 “”“Decision Forest in a Keras Model.
16
17 Usage example:
(…)
48 ```
49 “””
51 from typing import Callable, List
—> 53 from tensorflow_decision_forests.keras import core
54 from tensorflow_decision_forests.keras import wrappers
56 # Utility classes
File /anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow_decision_forests/keras/core.py:61
59 from tensorflow_decision_forests.component.inspector import inspector as inspector_lib
60 from tensorflow_decision_forests.component.tuner import tuner as tuner_lib
—> 61 from tensorflow_decision_forests.keras import core_inference
62 from tensorflow_decision_forests.tensorflow import core as tf_core
63 from tensorflow_decision_forests.tensorflow import tf1_compatibility
File /anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow_decision_forests/keras/core_inference.py:36
34 from tensorflow_decision_forests.tensorflow import core_inference as tf_core
35 from tensorflow_decision_forests.tensorflow import tf_logging
—> 36 from tensorflow_decision_forests.tensorflow.ops.inference import api as tf_op
37 from yggdrasil_decision_forests.learner import abstract_learner_pb2
38 from yggdrasil_decision_forests.learner.multitasker import multitasker_pb2
File /anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow_decision_forests/tensorflow/ops/inference/api.py:179
177 from tensorflow_decision_forests.component.inspector import inspector as inspector_lib
178 from tensorflow_decision_forests.tensorflow import tf1_compatibility
→ 179 from tensorflow_decision_forests.tensorflow.ops.inference import op
180 from yggdrasil_decision_forests.dataset import data_spec_pb2
181 from yggdrasil_decision_forests.model import abstract_model_pb2
File /anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow_decision_forests/tensorflow/ops/inference/op.py:15
1 # Copyright 2021 Google LLC.
2 #
3 # Licensed under the Apache License, Version 2.0 (the “License”);
(…)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
—> 15 from tensorflow_decision_forests.tensorflow.ops.inference.op_dynamic import *
File /anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow_decision_forests/tensorflow/ops/inference/op_dynamic.py:24
22 except Exception as e:
23 check_version.info_fail_to_load_custom_op(e, “inference.so”)
—> 24 raise e
26 # Importing all the symbols.
27 module = sys.modules[name]
File /anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow_decision_forests/tensorflow/ops/inference/op_dynamic.py:21
18 import sys
20 try:
—> 21 ops = tf.load_op_library(resource_loader.get_path_to_datafile(“inference.so”))
22 except Exception as e:
23 check_version.info_fail_to_load_custom_op(e, “inference.so”)
File /anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow/python/framework/load_library.py:54, in load_op_library(library_filename)
31 @tf_export(‘load_op_library’)
32 def load_op_library(library_filename):
33 “”“Loads a TensorFlow plugin, containing custom ops and kernels.
34
35 Pass “library_filename” to a platform-specific mechanism for dynamically
(…)
52 RuntimeError: when unable to load the library or get the python wrappers.
53 “””
—> 54 lib_handle = py_tf.TF_LoadLibrary(library_filename)
55 try:
56 wrappers = _pywrap_python_op_gen.GetPythonWrappers(
57 py_tf.TF_GetOpList(lib_handle))
NotFoundError: dlopen(/anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow_decision_forests/tensorflow/ops/inference/inference.so, 6): no suitable image found. Did find:
/anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow_decision_forests/tensorflow/ops/inference/inference.so: cannot load ‘inference.so’ (load command 0x80000034 is unknown)
/anaconda3/envs/py10/lib/python3.10/site-packages/tensorflow_decision_forests/tensorflow/ops/inference/inference.so: cannot load ‘inference.so’ (load command 0x80000034 is unknown)