decision-forests icon indicating copy to clipboard operation
decision-forests copied to clipboard

NotFoundError: undefined symbol: _ZNK10tensorflow8OpKernel11TraceStringERKNS_15OpKernelContextEb

Open oonisim opened this issue 2 years ago • 3 comments

Environment

Anaconda virtual python environment with TF 2.6.0 installed.

$ conda list | grep tensorflow
tensorflow                2.6.0            py38h1abaa86_1    conda-forge
tensorflow-base           2.6.0            py38he1e5d52_1    conda-forge
tensorflow-datasets       4.3.0              pyhd8ed1ab_0    conda-forge
tensorflow-decision-forests 0.1.9                    pypi_0    pypi    # <---- Installed via PIP as conda is not available
tensorflow-estimator      2.6.0            py38h45e38c2_1    conda-forge
tensorflow-metadata       1.2.0              pyhd8ed1ab_0    conda-forge

$ conda --version
conda 4.10.3

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"

Problem

Importing TF, TFDS are OK.

import os
import math
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow_datasets as tfds
from wurlitzer import sys_pipes


tf.__version__
---
2.6.0

Importing the tensorflow_decision_forests causes the issue. The same symbol issues was reported in https://github.com/tensorflow/text/issues/385 as well.

import tensorflow_decision_forests as tfdf
---
---------------------------------------------------------------------------
NotFoundError                             Traceback (most recent call last)
/tmp/ipykernel_120273/401816866.py in <module>
----> 1 import tensorflow_decision_forests as tfdf

~/conda/envs/python_38_ml/lib/python3.8/site-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

~/conda/envs/python_38_ml/lib/python3.8/site-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 

~/conda/envs/python_38_ml/lib/python3.8/site-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

~/conda/envs/python_38_ml/lib/python3.8/site-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

~/conda/envs/python_38_ml/lib/python3.8/site-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"))

~/conda/envs/python_38_ml/lib/python3.8/site-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: /home/oonisim/conda/envs/python_38_ml/lib/python3.8/site-packages/tensorflow_decision_forests/tensorflow/ops/training/training.so: undefined symbol: _ZNK10tensorflow8OpKernel11TraceStringERKNS_15OpKernelContextEb

Related

There is a suggestion that this could be TF version issue but not certain.

Try to uninstall tensorflow (in mine colab it was 2.6.0) install tf 2.5.0 and then install tensorflow_decision_forests.

oonisim avatar Nov 01 '21 21:11 oonisim

Hi @oonisim,

Your message falls right around the release of "tensorflow-decision-forests" 0.2.0, so wonder if this could be related to it.

Would you mind:

  1. Updating to the last version of TF and TF-DF.
  2. Restarting your notebook instance (if you use notebooke/colabs).
  3. Trying again to import TF-DF.

achoum avatar Nov 03 '21 09:11 achoum

Hi @achoum, please refer to the result below. This time I switched to Python venv (not virtualenv, etc) and pip only to make sure anaconda is not the cause.

Basically the same error.

Python environment

$ $ python --version
Python 3.8.10

$ pip list | grep tensorflow
tensorflow                   2.7.0    
tensorflow-datasets          4.4.0    
tensorflow-decision-forests  0.2.0    
tensorflow-estimator         2.7.0    
tensorflow-io-gcs-filesystem 0.21.0   
tensorflow-metadata          1.4.0    

$ pip list | grep jupyter
jupyter                      1.0.0    
jupyter-client               7.0.6    
jupyter-console              6.4.0    
jupyter-core                 4.9.1    
jupyterlab-pygments          0.1.2    
jupyterlab-widgets           1.0.2    

Jupyter Notebook

import tensorflow as tf
import tensorflow_datasets as tfds
from wurlitzer import sys_pipes


tf.__version__
---
`2.7.0'     # <--- PyPi tensorflow repository is updated to 2.7.0 

tf.__path__
---
['/home/oonisim/venv/ml/lib/python3.8/site-packages/keras/api/_v2',
 '/home/oonisim/venv/ml/lib/python3.8/site-packages/tensorflow_estimator/python/estimator/api/_v2',
 '/home/oonisim/venv/ml/lib/python3.8/site-packages/tensorboard/summary/_tf',
 '/home/oonisim/venv/ml/lib/python3.8/site-packages/tensorflow',
 '/home/oonisim/venv/ml/lib/python3.8/site-packages/tensorflow/_api/v2']

import tensorflow_decision_forests as tfdf
---
otFoundError                             Traceback (most recent call last)
/tmp/ipykernel_48567/401816866.py in <module>
----> 1 import tensorflow_decision_forests as tfdf

~/venv/ml/lib/python3.8/site-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

~/venv/ml/lib/python3.8/site-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 

~/venv/ml/lib/python3.8/site-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

~/venv/ml/lib/python3.8/site-packages/tensorflow_decision_forests/tensorflow/core.py in <module>
     33 from tensorflow.python.distribute import parameter_server_strategy_v2
     34 from tensorflow_decision_forests.tensorflow.distribute import tf_distribution_pb2
---> 35 from tensorflow_decision_forests.tensorflow.ops.training import api as training_op
     36 from yggdrasil_decision_forests.dataset import data_spec_pb2
     37 from yggdrasil_decision_forests.learner import abstract_learner_pb2

~/venv/ml/lib/python3.8/site-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"))

~/venv/ml/lib/python3.8/site-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: /home/oonisim/venv/ml/lib/python3.8/site-packages/tensorflow_decision_forests/tensorflow/ops/training/training.so: undefined symbol: _ZN10tensorflow11ResourceMgr8DoCreateERKSsNS_9TypeIndexES2_PNS_12ResourceBaseE

oonisim avatar Nov 06 '21 20:11 oonisim

@oonisim

I tried with colab and I am able to import tfdf successfully, You can take a look at the gist here.

P.S : The versions that I used are TF 2.8.0 and TFDF 0.2.4

sanatmpa1 avatar Apr 27 '22 05:04 sanatmpa1

Closing this since it is most likely outdated now.

rstz avatar Feb 22 '23 08:02 rstz

Closing this since it is most likely outdated now.

Same problem, after using TF 2.8.0 and TFDF 0.2.4 it only shows this

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. explainable-ai-sdk 1.3.2 requires xai-image-widget, which is not installed. tfx-bsl 1.5.0 requires absl-py<0.13,>=0.9, but you have absl-py 1.4.0 which is incompatible. tfx-bsl 1.5.0 requires numpy<1.20,>=1.16, but you have numpy 1.20.3 which is incompatible. tfx-bsl 1.5.0 requires pyarrow<6,>=1, but you have pyarrow 6.0.1 which is incompatible. tensorflow-transform 1.5.0 requires absl-py<0.13,>=0.9, but you have absl-py 1.4.0 which is incompatible. tensorflow-transform 1.5.0 requires numpy<1.20,>=1.16, but you have numpy 1.20.3 which is incompatible. tensorflow-transform 1.5.0 requires pyarrow<6,>=1, but you have pyarrow 6.0.1 which is incompatible. tensorflow-transform 1.5.0 requires tensorflow!=2.0.,!=2.1.,!=2.2.,!=2.3.,!=2.4.,!=2.5.,!=2.6.*,<2.8,>=1.15.2, but you have tensorflow 2.8.0 which is incompatible. tensorflow-io 0.21.0 requires tensorflow<2.7.0,>=2.6.0, but you have tensorflow 2.8.0 which is incompatible. tensorflow-io 0.21.0 requires tensorflow-io-gcs-filesystem==0.21.0, but you have tensorflow-io-gcs-filesystem 0.32.0 which is incompatible. tensorflow-decision-forests 1.2.0 requires tensorflow~=2.11.0, but you have tensorflow 2.8.0 which is incompatible.

kapedalex avatar Jun 09 '23 18:06 kapedalex

I believe that the issue you're seeing is the following: You are combining an outdated Tensorflow version (2.8.0) with an earlier TF-DF version (1.2.0). This is not possible since TF-DF and TF have to be in sync.

Possible solutions:

  • Force installation of TF-DF 0.2.4 pip install --force-reinstall -v "tensorflow-decision-forests==0.2.4"
  • Install the current Tensorflow version and TF-DF 1.3.0 pip install --force-reinstall tensorflow-decision-forests

rstz avatar Jun 13 '23 07:06 rstz