pyfilterbank icon indicating copy to clipboard operation
pyfilterbank copied to clipboard

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

Open benghau opened this issue 4 years ago • 1 comments

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?

benghau avatar Oct 19 '21 13:10 benghau

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

hahnec avatar Sep 29 '22 12:09 hahnec