error when importing tensorflow_addons
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
Yes - OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
Manjaro Linux - testing - TensorFlow installed from (source or binary):
binary, PyPi - TensorFlow version (use command below):
2.0.0-dev20190511 - TensorFlow Addons installed from (source, PyPi):
binary, PyPi - TensorFlow Addons version:
0.3.1 - Python version and type (eg. Anaconda Python, Stock Python as in Mac, or homebrew installed Python etc):
3.6.0 - Bazel version (if compiling from source):
- GCC/Compiler version (if compiling from source):
- Is GPU used? (yes/no):
yes - GPU model (if used):
Nvidia 1080 GTX
Describe the bug
I installed tensorflow-nightly-gpu-2.0-preview and tensorflow-addons from Pypi in a new conda environment containing only the Python 3.6 package + dependencies (installed from conda with conda install python==3.6, since tfa does not support yet Python 3.7).
My code crashes when importing the tensorflow_addons module in Python.
Describe the expected behavior
I expected no error message when importing the tensorflow_addons module installed from Pypi
Code to reproduce the issue
import tensorflow_addons
Other info / logs
from tensorflow_addons import seq2seq
File "/home/john_tukey/miniconda3/envs/tf20py36/lib/python3.6/site-packages/tensorflow_addons/__init__.py", line 75, in <module>
from tensorflow_addons import image
File "/home/john_tukey/miniconda3/envs/tf20py36/lib/python3.6/site-packages/tensorflow_addons/image/__init__.py", line 22, in <module>
from tensorflow_addons.image.distance_transform import euclidean_dist_transform
File "/home/john_tukey/miniconda3/envs/tf20py36/lib/python3.6/site-packages/tensorflow_addons/image/distance_transform.py", line 26, in <module>
get_path_to_datafile("custom_ops/image/_image_ops.so"))
File "/home/john_tukey/miniconda3/envs/tf20py36/lib/python3.6/site-packages/tensorflow/python/framework/load_library.py", line 61, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /home/john_tukey/miniconda3/envs/tf20py36/lib/python3.6/site-packages/tensorflow_addons/custom_ops/image/_image_ops.so: undefined symbol: _ZTVN10tensorflow14kernel_factory17OpKernelRegistrar18PtrOpKernelFactoryE
libgcc_s.so.1 must be installed for pthread_cancel to work
$ conda list
# packages in environment at /home/john_tukey/miniconda3/envs/tf20py36:
#
# Name Version Build Channel
absl-py 0.7.1 pypi_0 pypi
artifacts 20190320 pypi_0 pypi
astor 0.7.1 pypi_0 pypi
ca-certificates 2019.1.23 0
certifi 2019.3.9 py36_0
gast 0.2.2 pypi_0 pypi
google-pasta 0.1.6 pypi_0 pypi
grpcio 1.20.1 pypi_0 pypi
h5py 2.9.0 pypi_0 pypi
keras-applications 1.0.7 pypi_0 pypi
keras-preprocessing 1.0.9 pypi_0 pypi
libgcc-ng 8.2.0 hdf63c60_1
markdown 3.1 pypi_0 pypi
numpy 1.16.3 pypi_0 pypi
openssl 1.0.2r h7b6447c_0
pip 19.1.1 py36_0
protobuf 3.7.1 pypi_0 pypi
python 3.6.0 0
readline 6.2 2
setuptools 41.0.1 py36_0
six 1.12.0 pypi_0 pypi
sqlite 3.13.0 0
tb-nightly 1.14.0a20190511 pypi_0 pypi
tensorflow-addons 0.3.1 pypi_0 pypi
tensorflow-estimator-2-0-preview 1.14.0.dev2019051100 pypi_0 pypi
termcolor 1.1.0 pypi_0 pypi
tf-nightly-2-0-preview 2.0.0.dev20190511 pypi_0 pypi
tk 8.5.18 0
werkzeug 0.15.2 pypi_0 pypi
wheel 0.33.2 py36_0
wrapt 1.11.1 pypi_0 pypi
xz 5.2.4 h14c3975_4
zlib 1.2.11 h7b6447c_3
Same story with other calls to
tf.load_op_library(
get_path_to_datafile("custom_ops/ [...] ))
Since the error log mentions libgcc_s.so.1, I am also reporting the versions of glibc and gcc installed in my system:
glibc 2.29-1
gcc 8.3.0-1
Hi! So at the moment the addons that is on pypi is not compatible with tf-nightly... see https://github.com/tensorflow/addons/issues/193
You'll need to either run it with tensorflow==2.0.0.a0 or compile the master branch of this repo from source. Apologies for this mismatch and it should be solved soon when we get a TF2 release candidate.
Example: https://colab.research.google.com/drive/19-ZjcIr9m8KXVdkj0gnw_6xDLdlujI0t
Let me know if you still have issues
Thanks, @seanpmorgan
So far it works fine with tensorflow==2.0.0.a0.
@seanpmorgan Try as I might, I can't get tensorflow_addons to import with any kind of tensorflow 2.0 installation. What is the current method? I've tried every version I can think of from pypi and github.
Hi @rjurney see this colab example: https://colab.research.google.com/drive/19qzxyErdjnYIAJWFsdsStUk4eAzwTC4Z
pip install tensorflow-addons
pip install tensorflow==2.0.0-beta1
import tensorflow as tf
import tensorflow_addons as tfa
Let us know if you're still having issues and send us the error message if so. Thanks!
Hi Sean,
Seems there is a regress in the latest tf 2.1,
This is tf 2.0 Python 3.7.2 (default, Dec 29 2018, 06:19:36) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information.
import tensorflow as tf tf.version '2.0.0' import tensorflow_addons tensorflow_addons.version '0.6.0' from tensorflow_addons import text text.parse_time("2019-05-17T23:56:09.05Z", "%Y-%m-%dT%H:%M:%E*S%Ez", "NANOSECOND") <tf.Tensor: id=1, shape=(), dtype=int64, numpy=1558137369050000000>
This is tf 2.1, and same problem happens again.
tf.version '2.1.0-dev20191030' from tensorflow_addons import text Traceback (most recent call last): File "
", line 1, in File "/usr/local/google/home/leozwang/venv3.7/lib/python3.7/site-packages/tensorflow_addons/init.py", line 30, in from tensorflow_addons import text File "/usr/local/google/home/leozwang/venv3.7/lib/python3.7/site-packages/tensorflow_addons/text/init.py", line 38, in from tensorflow_addons.text.parse_time_op import parse_time File "/usr/local/google/home/leozwang/venv3.7/lib/python3.7/site-packages/tensorflow_addons/text/parse_time_op.py", line 25, in get_path_to_datafile("custom_ops/text/_parse_time_op.so")) File "/usr/local/google/home/leozwang/venv3.7/lib/python3.7/site-packages/tensorflow_core/python/framework/load_library.py", line 57, in load_op_library lib_handle = py_tf.TF_LoadLibrary(library_filename) tensorflow.python.framework.errors_impl.NotFoundError: /usr/local/google/home/leozwang/venv3.7/lib/python3.7/site-packages/tensorflow_addons/custom_ops/text/_parse_time_op.so: undefined symbol: _ZN4absl9ParseTimeERKSsS1_PNS_4TimeEPSs
Thanks! Please see #663
I am able to reproduce it with tf 2.1.
I get it too, I am using tf version 1.14.1. Is there any workaround for this ?
@karanbirchahal-bc I think that you do not need tensorflow_addons in Tensorflow 1.14. This repo started as a port of several tf.contrib modules due to maintainability issues, see here.
Not sure about tensorflow_addons==0.1, but everything starting from 0.2 was built to work with Tensorflow 2.
Do you require a specific module from addons that is not present in tf.contrib ?
Ah yes thank you ! I was able to fix this by downgrading onnx_tf to to a tf 1.x compatible branch. I have more more question before I close this issue. Does conversion with onnx between pytorch and tensrflow models guarantee the same exact output numerically between both models ?