SiggiGue / pyfilterbank

Implementing a fractional octave filterbank for python. Based on Numpy and CFFI.
107 stars 27 forks source link

Error installing on M1 Mac / Python 3.8 (sosfilt.so no suitable image found) #22

Open benghau opened 2 years ago

benghau commented 2 years ago

I successfully installed pyfilterbank according to the installation on the README, with no errors.

But when I imported pyfilterbank in my Jupiter notebook I received this error:

OSError: cannot load library '/Users/bg/miniforge3/envs/tf/lib/python3.8/site-packages/pyfilterbank/sosfilt.so': dlopen(/Users/bg/miniforge3/envs/tf/lib/python3.8/site-packages/pyfilterbank/sosfilt.so, 2): no suitable image found.  Did find:
    /Users/bg/miniforge3/envs/tf/lib/python3.8/site-packages/pyfilterbank/sosfilt.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
    /Users/bg/miniforge3/envs/tf/lib/python3.8/site-packages/pyfilterbank/sosfilt.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/Users/bg/miniforge3/envs/tf/lib/python3.8/site-packages/pyfilterbank/sosfilt.so'

Any advice on how to resolve this issue?

hahnec commented 1 year ago

To resolve the import error on my macOS, I used the following commands in the directory where sosfilt.so is located:

$ gcc -c -std=c99 -O3 sosfilt.c
$ gcc -shared -o sosfilt.so sosfilt.o