Mac M1 installation error

I recently tried to install OTB 8.0.0 on my M1 Macbook and got the following error:

$ ./OTB-8.0.0-Darwin64.run --target /Applications/OTB-8.0.0-Darwin64  
Creating directory /Applications/OTB-8.0.0-Darwin64
Verifying archive integrity...  100%   All good.
Uncompressing OrfeoToolBox 8.0.0  100%  
*****Warning******
OTB python bindings normally require python3.5.
The version of OTB_PYTHON_EXE (/Users/ashnair/miniconda3/bin/python3) is                   3.8.12.
This case is undefined unless you are sure the packages were                   build with this version of python.
OTB python bindings will be configured for /Users/ashnair/miniconda3/bin/python3                     ( version: 3.8.12 )
Found python library: /opt/local/lib/libpython3.8.dylib
Configuring...
Installing uninstall script for OTB 'tools/uninstall_otb.sh'

source './otbenv.profile' file to set required environment variables
eg: '. /Applications/OTB-8.0.0-Darwin64/otbenv.profile'
You can also copy above line to  ~/.profile to keep changes permanently!
More documentation can be found in /Applications/OTB-8.0.0-Darwin64/README

$ python -c "import otbApplication"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Applications/OTB-8.0.0-Darwin64/lib/python/otbApplication.py", line 15, in <module>
    import _otbApplication
ImportError: dlopen(/Applications/OTB-8.0.0-Darwin64/lib/python/_otbApplication.so, 0x0002): tried: '/Applications/OTB-8.0.0-Darwin64/lib/python/_otbApplication.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/_otbApplication.so' (no such file), '/usr/lib/_otbApplication.so' (no such file)

I’m guessing this might be because otb wasn’t compiled to work with M1. Is there a solution for this?

Hi,

We currently compile OTB only on intel Macs (that’s why there is the Darwin64 suffix), you are right we never have tried to compile it on M1 as there are a lot of dependencies and some of them are not ported to M1 yet. I think that Rosetta which translates x86_64 instructions to ARM64 can do the job with OTB but I don’t think that python also has this Rosetta interface. The solution will be available in a couple of days : an official docker image.

We will announce it on the forum and on the website. As we don’t have an M1 mac, tests will be greatly appreciated

Best regards

Dear @ashnair1,

Two docker images a available now. You can read more about this here.

Sincerely.
Julien :slight_smile:

1 Like

Thanks a lot Julien.

Funnily enough I ended up building docker images as well. The following repo contains images for all versions from 7.0.0 to 8.0.0 and uses github actions to build them.

1 Like