ImportError: dlopen(python/array_record_module.so, 0x000)

I am trying to run the following tensorflow code below which is mentioned in the following example(Creador de modelos TensorFlow Lite)

from tflite_model_maker import image_classifier
from tflite_model_maker.image_classifier import DataLoader

# Load input data specific to an on-device ML app.
data = DataLoader.from_folder('flower_photos/')
train_data, test_data = data.split(0.9)

# Customize the TensorFlow model.
model = image_classifier.create(train_data)

# Evaluate the model.
loss, accuracy = model.evaluate(test_data)

# Export to Tensorflow Lite model and label file in `export_dir`.
model.export(export_dir='/tmp/')

But I am getting an error as below

2023-05-14 13:43:07.639151: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
/usr/local/lib/python3.9/site-packages/tensorflow_addons/utils/tfa_eol_msg.py:23: UserWarning: 

TensorFlow Addons (TFA) has ended development and introduction of new features.
TFA has entered a minimal maintenance and release mode until a planned end of life in May 2024.
Please modify downstream libraries to take dependencies from other repositories in our TensorFlow community (e.g. Keras, Keras-CV, and Keras-NLP). 

For more information see: https://github.com/tensorflow/addons/issues/2807 

  warnings.warn(
Traceback (most recent call last):
  File "/Users/apple/Documents/modelmakersrc/maketflitemodel.py", line 3, in <module>
    from tflite_model_maker import model_spec
  File "/usr/local/lib/python3.9/site-packages/tflite_model_maker/__init__.py", line 44, in <module>
    from tflite_model_maker import audio_classifier
  File "/usr/local/lib/python3.9/site-packages/tflite_model_maker/audio_classifier/__init__.py", line 24, in <module>
    from tensorflow_examples.lite.model_maker.core.data_util.audio_dataloader import DataLoader
  File "/usr/local/lib/python3.9/site-packages/tensorflow_examples/lite/model_maker/core/data_util/audio_dataloader.py", line 27, in <module>
    from tensorflow_examples.lite.model_maker.core.task.model_spec import audio_spec
  File "/usr/local/lib/python3.9/site-packages/tensorflow_examples/lite/model_maker/core/task/model_spec/__init__.py", line 24, in <module>
    from tensorflow_examples.lite.model_maker.core.task.model_spec import text_spec
  File "/usr/local/lib/python3.9/site-packages/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py", line 44, in <module>
    from official.nlp.data import classifier_data_lib
  File "/usr/local/lib/python3.9/site-packages/official/nlp/data/classifier_data_lib.py", line 28, in <module>
    import tensorflow_datasets as tfds
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/__init__.py", line 43, in <module>
    import tensorflow_datasets.core.logging as _tfds_logging
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/__init__.py", line 22, in <module>
    from tensorflow_datasets.core import community
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/community/__init__.py", line 18, in <module>
    from tensorflow_datasets.core.community.huggingface_wrapper import mock_builtin_to_use_gfile
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/community/huggingface_wrapper.py", line 31, in <module>
    from tensorflow_datasets.core import dataset_builder
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/dataset_builder.py", line 34, in <module>
    from tensorflow_datasets.core import dataset_info
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/dataset_info.py", line 47, in <module>
    from tensorflow_datasets.core import file_adapters
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/file_adapters.py", line 29, in <module>
    from array_record.python import array_record_module
ImportError: dlopen(/usr/local/lib/python3.9/site-packages/array_record/python/array_record_module.so, 0x0002): tried: '/usr/local/lib/python3.9/site-packages/array_record/python/array_record_module.so' (not a mach-o file)

Following installed pip packages

Package Version


absl-py 1.4.0 array-record 0.2.0 astunparse 1.6.3 attrs 23.1.0 Automat 22.10.0 boltons 23.0.0 brotlipy 0.7.0 cachetools 5.3.0 certifi 2023.5.7 cffi 1.15.1 charset-normalizer 2.0.4 click 8.1.3 conda 23.3.1 conda-content-trust 0.1.3 conda-package-handling 2.0.2 conda_package_streaming 0.7.0 constantly 15.1.0 construct 2.10.68 cryptography 39.0.1 dm-tree 0.1.8 etils 1.3.0 flatbuffers 23.5.9 gast 0.4.0 google-auth 2.18.0 google-auth-oauthlib 1.0.0 google-pasta 0.2.0 googleapis-common-protos 1.59.0 grpcio 1.54.2 h5py 3.8.0 hyperlink 21.0.0 idna 3.4 importlib-resources 5.12.0 incremental 22.10.0 jax 0.4.10 jsonpatch 1.32 jsonpointer 2.1 keras 2.12.0 Keras-Preprocessing 1.1.2 libclang 16.0.0 Markdown 3.4.3 MarkupSafe 2.1.2 ml-dtypes 0.1.0 numpy 1.23.5 oauthlib 3.2.2 opt-einsum 3.3.0 packaging 23.0 pip 23.1.2 pluggy 1.0.0 ply 3.11 promise 2.3 protobuf 4.23.0 psutil 5.9.5 pyasn1 0.5.0 pyasn1-modules 0.3.0 pybind11 2.10.4 pycosat 0.6.4 pycparser 2.21 pycryptodomex 3.17 pyOpenSSL 23.0.0 pysmi 0.3.4 pysnmp 4.4.12 PySocks 1.7.1 PyYAML 6.0 requests 2.28.1 requests-oauthlib 1.3.1 rsa 4.9 ruamel.yaml 0.17.21 ruamel.yaml.clib 0.2.6 scipy 1.10.1 setuptools 65.6.3 six 1.16.0 tensor 0.3.6 tensorboard 2.12.3 tensorboard-data-server 0.7.0 tensorboard-plugin-wit 1.8.1 tensorflow 2.12.0 tensorflow-datasets 4.9.1 tensorflow-estimator 2.11.0 tensorflow-io-gcs-filesystem 0.32.0 tensorflow-metadata 1.13.1 termcolor 2.3.0 tflite-support 0.1.0a1 toml 0.10.2 toolz 0.12.0 tqdm 4.65.0 Twisted 22.10.0 typeguard 2.13.3 typing_extensions 4.5.0 urllib3 1.26.15 Werkzeug 2.3.4 wheel 0.38.4 wrapt 1.14.1 zipp 3.15.0 zope.interface 6.0 zstandard 0.19.0

@Charu,

Welcome to the Tensorflow Forum!

Could you please elaborate on your operating system and the steps you followed to install tensorflow and tflite-model-maker?

Thank you!

i followed this "not a mach-o file" error when trying to import on M1 Mac · Issue #4852 · tensorflow/datasets · GitHub , it got fixed