spleeter icon indicating copy to clipboard operation
spleeter copied to clipboard

[Bug] _pywrap_tensorflow_internal.so: invalid ELF header

Open mr-narender opened this issue 4 years ago • 1 comments

Description

After installing the Splitter (in docker using the instructions in the readme file), I can see that

root@cc0af452bb55:/spleeter# spleeter --version
Spleeter Version: 2.3.0

however, when I try to convert the demo file, I see this

root@cc0af452bb55:/spleeter# spleeter separate -p spleeter:2stems -o output audio_example.mp3
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: /usr/local/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: invalid ELF header

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/spleeter", line 8, in <module>
    sys.exit(entrypoint())
  File "/usr/local/lib/python3.8/site-packages/spleeter/__main__.py", line 256, in entrypoint
    spleeter()
  File "/usr/local/lib/python3.8/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/typer/main.py", line 497, in wrapper
    return callback(**use_params)  # type: ignore
  File "/usr/local/lib/python3.8/site-packages/spleeter/__main__.py", line 113, in separate
    from .audio.adapter import AudioAdapter
  File "/usr/local/lib/python3.8/site-packages/spleeter/audio/adapter.py", line 14, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 39, in <module>
    from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 83, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: /usr/local/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: invalid ELF header


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
root@cc0af452bb55:/spleeter#

and yes the files are present under same dir

Step to reproduce

I created a docker-compose file and Dockerfile based on the repo itself.

Environment

Type Value
OS MacOS
Installation type pip
RAM available 64Go
Hardware spec Apple M1

Additional context

I'm using MacBook with M1 Chip

If this was a mistake and we don't support the docker in the Apple M1 based, then I apologies, but before I stop my self, I wanted to be clear on this.

I don't have any another machine to test this on.

I have pushed the image to docker hub, so if any one wants to try it, can pull it from docker pull nar3nd3r/spleeter:m1

Any help is appreciated.

Thanks.

mr-narender avatar Jan 04 '22 21:01 mr-narender

Hi @nar3nd3r, So, the support for M1 is still not very good and your issue seem related to it: the invalid ELF header tends to say that you installed an intel library in an arm container (or the other way around) and then the container was not able to run it. I tried to run spleeter in an intel container (launched with the --platform linux/amd64 option) but couldn't manage to make spleeter work (always got a QEMU error caused by tensorflow).

For now, I would recommend to install spleeter natively on M1s following for instance the instructions provided in issue #696.

romi1502 avatar Jan 11 '22 14:01 romi1502