addons
addons copied to clipboard
0.18.0 pip package broken on MacOS
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): MacOS 12.5
- TensorFlow version and how it was installed (source or binary): binary
- TensorFlow-Addons version and how it was installed (source or binary): binary
- Python version: 3.8
- Is GPU used? (yes/no): no
Describe the bug Unable to execute custom ops due to link error
Code to reproduce the issue
import tensorflow as tf
import tensorflow_addons as tfa
print(tf.version.VERSION, tfa.__version__)
tfa.image.euclidean_dist_transform(tf.zeros([1, 16, 16, 2], 'uint8'), dtype='float32')
Other info / logs
---------------------------------------------------------------------------
NotFoundError Traceback (most recent call last)
Input In [9], in <cell line: 7>()
2 import tensorflow_addons as tfa
4 print(tf.version.VERSION, tfa.__version__)
----> 7 tfa.image.euclidean_dist_transform(tf.zeros([1, 16, 16, 2], 'uint8'), dtype='float32')
File ~/.pyenv/versions/3.8.6/lib/python3.8/site-packages/tensorflow_addons/image/distance_transform.py:67, in euclidean_dist_transform(images, dtype, name)
64 if dtype not in [tf.float16, tf.float32, tf.float64]:
65 raise TypeError("`dtype` must be float16, float32 or float64")
---> 67 output = _image_so.ops.addons_euclidean_distance_transform(images, dtype)
69 return img_utils.from_4D_image(output, original_ndims)
File ~/.pyenv/versions/3.8.6/lib/python3.8/site-packages/tensorflow_addons/utils/resource_loader.py:68, in LazySO.ops(self)
66 if self._ops is None:
67 self.display_warning_if_incompatible()
---> 68 self._ops = tf.load_op_library(
69 get_path_to_datafile(self.relative_path, is_so=True)
70 )
71 return self._ops
File ~/.pyenv/versions/3.8.6/lib/python3.8/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(/Users/alex/.pyenv/versions/3.8.6/lib/python3.8/site-packages/tensorflow_addons/custom_ops/image/_image_ops.so, 0x0006): Library not loaded: '@loader_path/../../../../../tensorflow_addons.dylibs/libtensorflow_framework.2.dylib'
Referenced from: '/Users/alex/.pyenv/versions/3.8.6/lib/python3.8/site-packages/tensorflow_addons/custom_ops/image/_image_ops.so'
Reason: tried: '/Users/alex/.pyenv/versions/3.8.6/lib/python3.8/site-packages/tensorflow_addons/custom_ops/image/../../../../../tensorflow_addons.dylibs/libtensorflow_framework.2.dylib' (no such file), '/usr/local/lib/libtensorflow_framework.2.dylib' (no such file), '/usr/lib/libtensorflow_framework.2.dylib' (no such file)
Can you check if it is similar to the old issue https://github.com/tensorflow/tensorflow/issues/38919 ?
print(tf.__file__)
# > /Users/alex/.pyenv/versions/3.8.6/lib/python3.8/site-packages/tensorflow/__init__.py
ls -la /Users/alex/.pyenv/versions/3.8.6/lib/python3.8/site-packages/tensorflow/
total 207392
drwxr-xr-x 17 alex staff 544 21 сен 09:40 .
drwxr-xr-x 599 alex staff 19168 22 сен 11:58 ..
-rw-r--r-- 1 alex staff 25120 21 сен 09:40 __init__.py
drwxr-xr-x 3 alex staff 96 21 сен 09:40 __pycache__
drwxr-xr-x 5 alex staff 160 21 сен 09:40 _api
drwxr-xr-x 9 alex staff 288 21 сен 09:40 compiler
drwxr-xr-x 14 alex staff 448 21 сен 09:40 core
drwxr-xr-x 5 alex staff 160 21 сен 09:40 distribute
drwxr-xr-x 6 alex staff 192 21 сен 09:40 dtensor
drwxr-xr-x 10 alex staff 320 21 сен 09:40 include
-rwxr-xr-x 1 alex staff 35384980 21 сен 09:40 libtensorflow_framework.2.10.0.dylib
-rwxr-xr-x 1 alex staff 35384980 21 сен 09:40 libtensorflow_framework.2.dylib
-rwxr-xr-x 1 alex staff 35384980 21 сен 09:40 libtensorflow_framework.dylib
drwxr-xr-x 8 alex staff 256 21 сен 09:40 lite
drwxr-xr-x 52 alex staff 1664 21 сен 09:40 python
drwxr-xr-x 8 alex staff 256 21 сен 09:40 tools
drwxr-xr-x 4 alex staff 128 21 сен 09:40 xla_aot_runtime_src
The name of linked lib is correct, the path is wrong
It seems to me that the paths don't match for libtensorflow_framework.2.dylib
I'm able to reproduce this. Will take a look as soon as time allows
Need to verify how this was missed in the tests as well
I can reproduce it in version 0.16.1. In my case, the broken is also introduced by tensorflow-macos==2.10.0. Here are some combinations I tried:
tensorflow-macos==2.8.0+tensorflow-addons==0.16.1: No issuetensorflow-macos==2.10.0+tensorflow-addons==0.16.1: Has issuetensorflow-macos==2.8.0+tensorflow-addons==0.18.0: Has issue
In tensorflow-macos==2.8.0 + tensorflow-addons==0.18.0, the issue is the same as the one reported in this thread, which is the libtensorflow_framework.2.dylib file cannot be found.
However, in tensorflow-macos==2.10.0 + tensorflow-addons==0.16.1, the issue is different, where the dylib file could be found, but the Symbol couldn't be found in the dylib file:
NotFoundError: dlopen(/Volumes/Data/Projects/coreml/coremltools/envs/coremltools-py3.8/lib/python3.8/site-packages/tensorflow_addons/custom_ops/image/_resampler_ops.so, 0x0006): Symbol not found: __ZN10tensorflow14kernel_factory17OpKernelRegistrar12InitInternalEPKNS_9KernelDefEN4absl12lts_2021032411string_viewENSt3__110unique_ptrINS0_15OpKernelFactoryENS8_14default_deleteISA_EEEE
E Referenced from: <FC93E9F1-497B-3C58-96FB-E448A6474E72> /Volumes/Data/Projects/coreml/coremltools/envs/coremltools-py3.8/lib/python3.8/site-packages/tensorflow_addons/custom_ops/image/_resampler_ops.so
E Expected in: <7540F750-D2E5-393B-8045-32F863185E30> /Volumes/Data/Projects/coreml/coremltools/envs/coremltools-py3.8/lib/python3.8/site-packages/tensorflow/libtensorflow_framework.2.dylib
Release 0.19.0, issue still here