tensorflow / io

Dataset, streaming, and file system extensions maintained by TensorFlow SIG-IO
Apache License 2.0
706 stars 287 forks source link

IOTensor.from_hdf5 not working on linux #1547

Open metalglove opened 3 years ago

metalglove commented 3 years ago

I am creating a dataset using the tfio API and I have it working on Windows. However, whenever I try to use it on linux it gets a NotImplementedError: ... libtensorflow_io.so ... undefined symbol: _ZNK10tensorflow4data15DatasetOpKernel11TraceStringERKNS_15OpKernelContextEb. I am running Python 3.9 and have Tensorflow 2.6 and tensorflow-io 0.21.0 installed.

The complete script:

import tensorflow as tf
import tensorflow_io as tfio
print(f'TensorFlow: {tf.__version__}')
print(f'TensorFlow IO: {tfio.__version__}')

spec = { '/metadata/samples': tf.TensorArraySpec(infer_shape = True, dtype=tf.int64) }
hdf5_io_tensor = tfio.IOTensor.from_hdf5("/somewhere/data_ef30afb1-7734-4060-b6e2-fd57d73b9d70/data.h5", spec=spec)
samples = hdf5_io_tensor('/metadata/samples').to_tensor().numpy()[0]
print(samples)

The complete output:

TensorFlow: 2.6.0
TensorFlow IO: 0.21.0
NotImplementedError                       Traceback (most recent call last)
/somewhere/tmp/ipykernel_234227/670031934.py in <module>
----> 1 hdf5_io_tensor = tfio.IOTensor.from_hdf5("/somewhere/data_ef30afb1-7734-4060-b6e2-fd57d73b9d70/data.h5", spec=spec)
      2 samples = hdf5_io_tensor('/metadata/samples').to_tensor().numpy()[0]
      3 print(samples)

/somewhere/modelling-v2/lib/python3.9/site-packages/tensorflow_io/python/ops/io_tensor.py in from_hdf5(cls, filename, spec, **kwargs)
    376         """
    377         with tf.name_scope(kwargs.get("name", "IOFromHDF5")):
--> 378             return hdf5_io_tensor_ops.HDF5IOTensor(filename, spec=spec, internal=True)
    379 
    380     @classmethod

/somewhere/modelling-v2/lib/python3.9/site-packages/tensorflow_io/python/ops/hdf5_io_tensor_ops.py in __init__(self, filename, spec, internal)
    130     def __init__(self, filename, spec=None, internal=False):
    131         with tf.name_scope("HDF5IOTensor"):
--> 132             columns, shapes, dtypes = core_ops.io_hdf5_readable_info(
    133                 filename, shared=filename, container="HDF5IOTensor"
    134             )

/somewhere/modelling-v2/lib/python3.9/site-packages/tensorflow_io/python/ops/__init__.py in __getattr__(self, attrb)
     86 
     87     def __getattr__(self, attrb):
---> 88         return getattr(self._load(), attrb)
     89 
     90     def __dir__(self):

/somewhere/modelling-v2/lib/python3.9/site-packages/tensorflow_io/python/ops/__init__.py in _load(self)
     82     def _load(self):
     83         if self._mod is None:
---> 84             self._mod = _load_library(self._library)
     85         return self._mod
     86 

/somewhere/modelling-v2/lib/python3.9/site-packages/tensorflow_io/python/ops/__init__.py in _load_library(filename, lib)
     67         except (tf.errors.NotFoundError, OSError) as e:
     68             errs.append(str(e))
---> 69     raise NotImplementedError(
     70         "unable to open file: "
     71         + "{}, from paths: {}\ncaused by: {}".format(filename, filenames, errs)

NotImplementedError: unable to open file: libtensorflow_io.so, from paths: ['/somewhere/modelling-v2/lib/python3.9/site-packages/tensorflow_io/python/ops/libtensorflow_io.so']
caused by: ['/somewhere/modelling-v2/lib/python3.9/site-packages/tensorflow_io/python/ops/libtensorflow_io.so: undefined symbol: _ZNK10tensorflow4data15DatasetOpKernel11TraceStringERKNS_15OpKernelContextEb']
metalglove commented 3 years ago

Also tried python 3.8, same undefined symbol error.

metalglove commented 3 years ago

Am I the only one having this issue?

scshtyk commented 2 years ago

Hi

Did you solve this problem?

I am running Python 3.6 have tensorflow==2.5.2(compiled by myself) tensorflow-io==0.18.0 installed. run conformer demo and get this error: NotImplementedError: unable to open file: libtensorflow_io.so, from paths: ['/home/tianyukun/.local/lib/python3.6/site-packages/tensorflow_io/core/python/ops/libtensorflow_io.so'] caused by: ['/home/tianyukun/.local/lib/python3.6/site-packages/tensorflow_io/core/python/ops/libtensorflow_io.so: undefined symbol: _ZTVN10tensorflow13GcsFileSystemE']

metalglove commented 2 years ago

Hi

Did you solve this problem?

I am running Python 3.6 have tensorflow==2.5.2(compiled by myself) tensorflow-io==0.18.0 installed. run conformer demo and get this error: NotImplementedError: unable to open file: libtensorflow_io.so, from paths: ['/home/tianyukun/.local/lib/python3.6/site-packages/tensorflow_io/core/python/ops/libtensorflow_io.so'] caused by: ['/home/tianyukun/.local/lib/python3.6/site-packages/tensorflow_io/core/python/ops/libtensorflow_io.so: undefined symbol: _ZTVN10tensorflow13GcsFileSystemE']

Nope. I never managed to solve this problem. I instead opted for the h5py library.