google / array_record

Apache License 2.0
73 stars 15 forks source link

Cannot import `array_record_module` on Apple Silicon #44

Open rpeloff opened 1 year ago

rpeloff commented 1 year ago

Hi, I am having trouble using this package on Apple Silicon (M2) due to the shared library file array_record_module.so.

Specifically I have the following error on Python 3.9.16 with array-record==0.2.0:

>>> from array_record.python import array_record_module
ImportError: dlopen(/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so, 0x0002): tried: '/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (no such file), '/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (not a mach-o file), '/Users/rp.eloff/.pyenv/versions/3.9.16/envs/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/rp.eloff/.pyenv/versions/3.9.16/envs/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (no such file), '/Users/rp.eloff/.pyenv/versions/3.9.16/envs/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (not a mach-o file)

I assume this is due to array_record_module.so being built for linux. Would it be possible to support Apple Silicon in the build process?

The main motivation for this is that tfds is dependent on array-record since this commit https://github.com/tensorflow/datasets/commit/f2aa83d533ca6b70a44252bbc912dd5b73904fd4.

The complete issue:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/tensorflow_datasets/__init__.py", line 43, in <module>
    import tensorflow_datasets.core.logging as _tfds_logging
  File "/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/tensorflow_datasets/core/__init__.py", line 22, in <module>
    from tensorflow_datasets.core import community
  File "/Users/rp.eloff/.pyenv/versions/test-array-record-py39/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 "/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/tensorflow_datasets/core/community/huggingface_wrapper.py", line 31, in <module>
    from tensorflow_datasets.core import dataset_builder
  File "/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/tensorflow_datasets/core/dataset_builder.py", line 34, in <module>
    from tensorflow_datasets.core import dataset_info
  File "/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/tensorflow_datasets/core/dataset_info.py", line 47, in <module>
    from tensorflow_datasets.core import file_adapters
  File "/Users/rp.eloff/.pyenv/versions/test-array-record-py39/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(/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so, 0x0002): tried: '/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (no such file), '/Users/rp.eloff/.pyenv/versions/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (not a mach-o file), '/Users/rp.eloff/.pyenv/versions/3.9.16/envs/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/rp.eloff/.pyenv/versions/3.9.16/envs/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (no such file), '/Users/rp.eloff/.pyenv/versions/3.9.16/envs/test-array-record-py39/lib/python3.9/site-packages/array_record/python/array_record_module.so' (not a mach-o file)
nouiz commented 1 year ago

I think this issue is also related to https://github.com/google/array_record/issues/71 Mostly, pip install should have failed as M2 are ARM computer to my knowledge. Maybe there is additional work needed then #71.

vyeevani commented 1 month ago

I've forked and have a release that build the python wheels for array_record here: https://github.com/vyeevani/array_record. Also have a PR on this repo: https://github.com/google/array_record/pull/118