MIC-DKFZ / HD-BET

MRI brain extraction tool
Apache License 2.0
255 stars 61 forks source link

Can't run hd-bet on apple silicon #51

Closed LennartPhil closed 6 months ago

LennartPhil commented 6 months ago

I'm currently trying to run the application on an M3Pro processor, unfortunately I'm only getting the following error messages.

Regular usage: hd-bet -i /Users/XXXXXXXXX/Desktop/01005097/01005097_T1.nii.gz -o /Users/XXXXXXXXX/Desktop/01005097/01005097_T1_brainextracted.nii.gz

Output: Original error was: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (no such file), '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

Using CPU-mode only: hd-bet -i /Users/XXXXXXXXX/Desktop/01005097/01005097_T1.nii.gz -o /Users/XXXXXXXXX/Desktop/01005097/01005097_T1_brainextracted.nii.gz -device cpu -mode fast -tta 0

Output: Original error was: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (no such file), '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

Both error massages are a bit longer, as another exception occurred during the handling of the first exception.

Has anyone found a solution to this problem?

Oddly enough, I have also installed the HD-BET extension for Slicer, where it seems to work as expected.

LennartPhil commented 6 months ago

I got it to work after redownloading Rosetta 2, uninstalling numpy using pip uninstall numpy and then downloading numpy for arm64 using arch -arm64 pip install numpy. Thus I'm closing the issue and apologise for the inconvenience