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

OSError when importing opensmile on MacBook M1 laptop

Open omertzuk opened this issue 3 years ago • 13 comments

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?

omertzuk avatar Nov 23 '22 15:11 omertzuk

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 avatar Nov 23 '22 18:11 hagenw

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

$ pip install --upgrade audresample

and try again.

hagenw avatar Jan 27 '23 13:01 hagenw

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'))

owuQQQ avatar Feb 14 '23 10:02 owuQQQ

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()

hagenw avatar Feb 14 '23 11:02 hagenw

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'
>>>

hendryman avatar Feb 14 '23 20:02 hendryman

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.

hagenw avatar Feb 15 '23 06:02 hagenw

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 avatar Mar 03 '23 21:03 hendryman

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/[email protected]/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/[email protected]/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'))

hendryman avatar Mar 05 '23 08:03 hendryman

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.

hagenw avatar Mar 13 '23 07:03 hagenw

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...

hendryman avatar Apr 24 '23 11:04 hendryman

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

lrjam avatar Jun 23 '23 04:06 lrjam

There are two steps this:

  • provide M1 support for the used audresample lib, which was done with version 1.3.1
  • compile opensmile binaries for M1 and include in this repo

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 avatar Jun 23 '23 09:06 hagenw

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

hagenw avatar Oct 19 '23 15:10 hagenw