opensmile-python icon indicating copy to clipboard operation
opensmile-python copied to clipboard

OSError: /path_to_file/libaudresample.so: cannot open shared object file: No such file or directory

Open funnyshape opened this issue 1 year ago • 20 comments

Hi,

my Issue may or may not be related to #26. When I try to import opensmile, right at the beginning of a python script, this error is thrown:

File "/media/pi1/E04C-9C99/Audio_Pi/SentenceDetect.py", line 11, in import opensmile File "/usr/local/lib/python3.9/dist-packages/opensmile/init.py", line 6, in from opensmile.core.smile import ( File "/usr/local/lib/python3.9/dist-packages/opensmile/core/smile.py", line 10, in import audinterface File "/usr/local/lib/python3.9/dist-packages/audinterface/init.py", line 2, in from audinterface import utils File "/usr/local/lib/python3.9/dist-packages/audinterface/utils/init.py", line 1, in from audinterface.core.utils import ( File "/usr/local/lib/python3.9/dist-packages/audinterface/core/utils.py", line 11, in import audresample File "/home/pi1/audresample/audresample/init.py", line 2, in from audresample.core.api import ( File "/home/pi1/audresample/audresample/core/api.py", line 8, in from audresample.core.lib import lib File "/home/pi1/audresample/audresample/core/lib.py", line 29, in lib = ctypes.cdll.LoadLibrary(lib_path) File "/usr/lib/python3.9/ctypes/init.py", line 452, in LoadLibrary return self._dlltype(name) File "/usr/lib/python3.9/ctypes/init.py", line 374, in init self._handle = _dlopen(self._name, mode) OSError: /home/pi1/audresample/audresample/core/bin/linux/libaudresample.so: cannot open shared object file: No such file or directory

OS: pi os 64 bit python version: 3.9.2 gcc( if needed, looking at issue #33): Debian 10.2.1-6

I already tried to set LD_LIBRARY_PATH, but this did not resolve the issue. Any help would be appreciated!

funnyshape avatar Mar 30 '23 14:03 funnyshape

The place it tries to load libaudresample.so looks strange to me. Did you install the package to a virtual environment?

For example, if I install audresample to a virtual environment called test with:

$ virtualenv --python=python3.9 test
$ source test/bin/activate
$ pip install audresample

I have the needed file and can also import audresample:

$ ls test/lib/python3.9/site-packages/audresample/core/bin/linux/libaudresample.so
test/lib/python3.9/site-packages/audresample/core/bin/linux/libaudresample.so
$ python -c "import audresample; print(audresample.__version__)"
1.2.1

hagenw avatar Mar 31 '23 10:03 hagenw

It seems like the following code we use inside audresample is not sufficient to find the correct folder in your case:

https://github.com/audeering/audresample/blob/3cd2bff35a2818698316c466a8d84dc6816014c3/audresample/core/lib.py#L8-L14

hagenw avatar Mar 31 '23 10:03 hagenw

Thank you for your answers. I tried it with and without venv, unfortunately the result is the same.

With ls ... my pi does find the .so file, but I am not even able to import audresample via the import-statement. The Error-Statement is basically the same as above.

Do you think there could be a workaround to find the correct folder?

funnyshape avatar Apr 03 '23 10:04 funnyshape

Do you think there could be a workaround to find the correct folder?

Did you try to copy it manually to: /home/pi1/audresample/audresample/core/bin/linux/libaudresample.so?

frankenjoe avatar Apr 03 '23 10:04 frankenjoe

The file is already there, with permissions set to be executable and viewable by everyone.

funnyshape avatar Apr 03 '23 11:04 funnyshape

The file is already there, with permissions set to be executable and viewable by everyone.

I see, then the problem is not that it cannot find the file, but rather that it cannot load the shared library.

frankenjoe avatar Apr 03 '23 11:04 frankenjoe

Seems so, but I am somewhat lost why this could be the case.

funnyshape avatar Apr 03 '23 12:04 funnyshape

OS: pi os 64 bit

It seems you are trying to run on a Raspberry Pi, correct? I think it needs arm64 as architecture, but we support only x86-64 at the moment.

hagenw avatar Apr 03 '23 12:04 hagenw

Yes, I am using a Raspberry Pi. Ah okay, so there is the problem. Do you have, by any chance, the plan to change that in the future?

funnyshape avatar Apr 03 '23 12:04 funnyshape

Unfortunately, there is no arm64 runner available on Github (https://github.com/actions/runner-images/issues/5631).

There is the option to create a docker image for arm64 and use the docker image to build the binary, e.g. https://github.com/WebAssembly/wabt/pull/2184/files. Or alternatively, we can use an internal runner to build the library. So, yes, it should be possible to add support for it, and we will look into it.

hagenw avatar Apr 03 '23 12:04 hagenw

Okay, thank you very much!

funnyshape avatar Apr 03 '23 12:04 funnyshape

Could you maybe use platform (import platform) in Python and report the output of the following two commands from the PI:

  • platform.system()
  • platform.processor()

hagenw avatar Apr 03 '23 12:04 hagenw

  • Platform.system: Linux
  • Platform.processor: Does not return anything, I will look into that.

funnyshape avatar Apr 03 '23 12:04 funnyshape

With lscpu I get the following info: Architecture: aarch64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Vendor ID: ARM Model: 3 Model name: Cortex-A72 Stepping: r0p3

funnyshape avatar Apr 03 '23 13:04 funnyshape

We build a binary on our RaspberryPi which has:

$ uname -m
armv7l

As a test you could copy it to the audresample/core/bin/linux/ and see if this help fixing the audresample import error. opensmile will then still not work for you as there we also need to update the binaries. But it would help if you could test if the new audresample binary works on your RaspberryPi as well.

libaudresample.zip

hagenw avatar Apr 05 '23 11:04 hagenw

Thank you! Unfortunately I get a new error: wrong ELF class: ELFCLASS32

funnyshape avatar Apr 11 '23 05:04 funnyshape

I guess, I made an error in providing you the ARMv7 binary as you have 64-bit. I attached here a ARMv8 binary that works with 64-bit, could you try again if this works?

linux-armv8.zip

hagenw avatar May 05 '23 07:05 hagenw

Hi, sorry for the late answer! After inserting the file I get a new Error-Message:

OSError: /home/pi1/.local/lib/python3.9/site-packages/opensmile/core/bin/linux/libSMILEapi.so: cannot open shared object file: No such file or directory

Although the file exists in this place.

funnyshape avatar Jun 29 '23 11:06 funnyshape

Thanks for the feedback. This means audresample does now indeed work on your machine.

The error you are seeing now is due to missing support for ARMv8 in opensmile. We will be able to add it when we have setup the needed scripts to solve https://github.com/audeering/opensmile-python/issues/78 during the next months.

hagenw avatar Jun 30 '23 05:06 hagenw

With release 2.5.0 of opensmile we should now support Raspberry PI. Could you maybe try to update your installation and try again.

hagenw avatar Oct 19 '23 15:10 hagenw