audeering / opensmile-python

Python package for openSMILE
https://audeering.github.io/opensmile-python/
Other
240 stars 32 forks source link

OSError when importing opensmile on MacBook M1 laptop #64

Open Omer80 opened 1 year ago

Omer80 commented 1 year ago

I installed opensmile in a miniforge3 environment, but when I try to import it I get the following error: OSError: dlopen(/Users/omertzuk/miniforge3/envs/tf/lib/python3.8/site-packages/audresample/core/bin/libaudresample.dylib, 0x0006): tried: '/Users/omertzuk/miniforge3/envs/tf/lib/python3.8/site-packages/audresample/core/bin/libaudresample.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))

Is there a way to make it work on x86_64 architecture?

hagenw commented 1 year ago

We currently do not support M1, see also https://github.com/audeering/audresample/issues/21.

But we are planing to add it in the near future.

hagenw commented 1 year ago

We have now made a new release of audresample supporting MacOS M1 architecture. Please update audresample with:

$ pip install --upgrade audresample

and try again.

owuQQQ commented 1 year ago

I tried to upgrade the audresample, but it seems not to work.

I got the following errors:

dlopen(/Users/yuwang/miniforge3/lib/python3.10/site-packages/audresample/core/bin/macos-intel/libaudresample.dylib, 0x0006): tried: '/Users/yuwang/miniforge3/lib/python3.10/site-packages/audresample/core/bin/macos-intel/libaudresample.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/yuwang/miniforge3/lib/python3.10/site-packages/audresample/core/bin/macos-intel/libaudresample.dylib' (no such file), '/Users/yuwang/miniforge3/lib/python3.10/site-packages/audresample/core/bin/macos-intel/libaudresample.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

hagenw commented 1 year ago

Thanks for reporting again.

What seems strange to me is that it tries to load macos-intel/libaudresample.dylib, whereas it should load macos-m1/libaudresample.dylib.

Could you post the output of the following two commands:

platform.system()
platform.processor()
hendryman commented 1 year ago

I have exactly the same problem except "intel" does not show up in my error:

OSError: dlopen(/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib, 0x0006): tried: '/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib' (no such file), '/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

>>> platform.system()
'Darwin'
>>> platform.processor()
'arm'
>>>
hagenw commented 1 year ago

I have exactly the same problem except "intel" does not show up in my error:

OSError: dlopen(/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib, 0x0006): tried: '/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib' (no such file), '/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

>>> platform.system()
'Darwin'
>>> platform.processor()
'arm'
>>>

We added support for MacOS M1 only with version 1.2.0 of audresample, please run

$ pip install --upgrade audresample

and try again.

We are catching the case of 'Darwin' and 'arm' at https://github.com/audeering/audresample/blob/3cd2bff35a2818698316c466a8d84dc6816014c3/audresample/core/lib.py#L21-L26. In a CI job on our internal M1 runner it does work.

hendryman commented 1 year ago
pip install --upgrade audresample                                      ✔
Requirement already satisfied: audresample in /opt/homebrew/lib/python3.10/site-packages (1.2.1)

Any idea where else the source of the problem could be?

hendryman commented 1 year ago

I tried this:

pip install --upgrade audresample --force-reinstall --no-cache-dir

Which gives me:

Downloading audresample-1.2.1-py3-none-any.whl (494 kB)
(...)
Successfully installed audresample-1.2.1 (...)

But it did not help either...

Here's the full error message I get on my MacBook Pro M1 Max:

python3 /Users/manuel/opensmile-python/tests/test_smile.py 

Traceback (most recent call last):
  File "/Users/manuel/Dropbox/GitHub/repos/feelingmachine/develop/emo_detect/opensmile-python/tests/test_smile.py", line 11, in <module>
    import opensmile
  File "/opt/homebrew/lib/python3.10/site-packages/opensmile/__init__.py", line 6, in <module>
    from opensmile.core.smile import (
  File "/opt/homebrew/lib/python3.10/site-packages/opensmile/core/smile.py", line 13, in <module>
    from opensmile.core.SMILEapi import (
  File "/opt/homebrew/lib/python3.10/site-packages/opensmile/core/SMILEapi.py", line 23, in <module>
    smileapi = cdll.LoadLibrary(smileapi_path)
  File "/opt/homebrew/Cellar/python@3.10/3.10.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/opt/homebrew/Cellar/python@3.10/3.10.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib, 0x0006): tried: '/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib' (no such file), '/opt/homebrew/lib/python3.10/site-packages/opensmile/core/bin/osx/libSMILEapi.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
hagenw commented 1 year ago

You are right, we need to provide openSMILE binaries for M1 as well, audresample is of cause not enough. So at the moment we don't support M1 with the Python package of openSMILE and will need to add it.

hendryman commented 1 year ago

Just checking if there's hope here : ) Would love to implement openSMILE for this but can't because I'm stuck on a M1 laptop...

lrjam commented 1 year ago

Anyone got any updates on this? Praying for a fix. TIA!

hagenw commented 1 year ago

There are two steps this:

Both steps require that we use internal CI runners to build the required binaries. For opensmile this is slightly more complicated and requires certain developers to have time to work on this, which means I cannot directly say when this will be done, but my hope would be that it is solved in the next 3 months.

hagenw commented 11 months ago

With release 2.5.0 we have now added support for M1. Could you please update your installation and try again.