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

I too have issues with the M1 Max and installation. I’ve installed using the docker image as shown on the Mac installation. It appears to install yet when I run the command for CLI and the GUI, I get the following errors:

CLI
docker run -it orfeotoolbox/otb
WARNING: The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
root@623e06d86243:/#

GUI
docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix/ --device=/dev/dri:/dev/dri orfeotoolbox/otb monteverdi
WARNING: The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
docker: Error response from daemon: error gathering device information while adding custom device “/dev/dri”: no such file or directory.
ERRO[0000] error waiting for container: context canceled

Can I get guidance on how to proceed?

Thank you.

Hi @jridout

Can you try calling the otb docker image with : docker run -it orfeotoolbox/otb --platform linux/amd64
This command line option tells docker to use the intel emulation layer embedded in MacOS called Rosetta
If you want to use GUI apps on M1 you need to install X11 / XQuartz which is not installed by default on MacOS.
https://www.xquartz.org/

Let me know if it works
Regards

Thanks for your reply and I appreciate the help.
I have installed X11 and Rosetta and still get the same errors. Using the above syntax docker run -it orfeotoolbox/otb --platform linux/amd64 I receive the following error:

WARNING: The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: “–platform”: executable file not found in $PATH: unknown.
ERRO [0000] error waiting for container: context canceled

Thanks again for the help!

My bad, you have to put the platform argument before orfeotoolbox/otb because it is an argument to Docker, not an argument to the otb image.
docker run -it --platform linux/amd64 orfeotoolbox/otb

Success! Thank you for your help, it is much appreciated.

I’m still having issues trying to start the Monteverdi GUI. I’m now receiving the error:

Error response from daemon: error gathering device information while adding custom device “/dev/dri”: no such file or directory.
ERRO[0000] error waiting for container: context canceled

I can process using the CLI but it would be nice to work in the GUI as well.

Perfect, that is a good news for the CLI!

About the GUI, it is because /dev/dri is not available on MacOS, you can try

docker run -it --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix:/tmp/.X11-unix:rw <image name>

If if it is not working the first time, from the XQuartz preferences, in the security tab, make sure Allow connections from network clients is enabled.

Then in a terminal launch :
xhost +localhost

Then relaunch the docker command

Let me know