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: :slight_smile:](https://forum.orfeo-toolbox.org/images/emoji/twitter/slight_smile.png?v=12)
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
Hi i think i followed the install instructions exactly as on the docker hub page. i also installed xquartz and allowed all connections before running:
xhost + localhost
and
docker run -it --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix/:/tmp/.X11-unix/:rw orfeotoolbox/otb:8.1.0 monteverdi
however i get this message:
WARNING: The requested imageās platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
qt.qpa.xcb: could not connect to display host.docker.internal:0
qt.qpa.plugin: Could not load the Qt platform plugin āxcbā in āā even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: linuxfb, minimal, offscreen, vnc, xcb.
qemu: uncaught target signal 6 (Aborted) - core dumped
a container was build with a warning though:
I am not sure if everything worked out as expected since I got those warnings.
Please let me know if you have any feedback to those warnings ![:slight_smile: :slight_smile:](https://forum.orfeo-toolbox.org/images/emoji/twitter/slight_smile.png?v=12)
best regards
Hi hvutuyen,
The warning is normal since your CPU architecture is ARM64 (M1) and the docker image is built upon amd64 architecture. In MacOS there is a thing called Rosetta that can launch amd64 apps (including docker images) on arm64.
I think there is something missing in the docker hub page, can you try :
docker run -it --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix/:/tmp/.X11-unix/:rw --platform=linux/amd64 orfeotoolbox/otb:8.1.0 monteverdi
The warning will disappear, but there is something wrong with the display variable, I will get back to you with more informations (We donāt have an M1 mac to test so every feedback is welcomed)
If this still does not work with the platform argument, can you try replacing
host.docker.internal:0
by
${HOSTNAME}:0
Best regards
Hi thibaut.romain,
thanks for the fast response!
i tried
docker run -it --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix/:/tmp/.X11-unix/:rw --platform=linux/amd64 orfeotoolbox/otb:8.1.0 monteverdi
and
docker run -it --env="DISPLAY=${HOSTNAME}:0" -v /tmp/.X11-unix/:/tmp/.X11-unix/:rw --platform=linux/amd64 orfeotoolbox/otb:8.1.0 monteverdi
but i still get the same warning:
qt.qpa.xcb: could not connect to display host.docker.internal:0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Best regards
Available platform plugins are: linuxfb, minimal, offscreen, vnc, xcb.
qemu: uncaught target signal 6 (Aborted) - core dumped
also the warning on the container is still there.
I try to install the toolbox and use it as a plugin with QGIS. I have not found any instructions how to install/use it properly for M1 yet.
Do I need the xquartz for that purpose?
The only way to use OTB in M1 macs is to use the docker image, because the toolbox is built for amd64 architecture and building it for arm64 means a lot of work for all the dependencies of OTB to get it working, i donāt know if it is going to happen.
You are trying to use the gui part of OTB, is it mandatory for you? the GUI use X11, which is inside the app XQuartz that is mandatory to launch before using X11 gui apps. If it isnāt mandatory i would recommend using only the cli, in that case you donāt need xquartz and all DISPLAY environment etc. I know that the cli works well on M1 Macs. The main problem is interfacing xquartz and docker. I will make some further research and get back to you asap.
The āhost.docker.internal:0ā error guides me to a docker configuration problem
I also see a qemu error, are you using docker inside a VM ? that would explain the error above
I havenāt tried yet to use OTB with QGIS on M1 Macs, i donāt know if QGIS will recognize the otb applications as they are not built for arm64
Best regards
I just found out, I donāt necessarily need xquartz ![:slight_smile: :slight_smile:](https://forum.orfeo-toolbox.org/images/emoji/twitter/slight_smile.png?v=12)
And I donāt think it is possible to import the Orfeo Toolbox into QGIS out of a Docker Image, since there is no physical path/installation to the Orfeo application, as far as I understood.
thanks for your help, I really appreciate it!
best regards
Glad to here you succeed with the cli, I think too that it is impossible to import OTB from a docker image
If you see any other problem with the M1 please let us know, the more testers there are, the quicker we can try to fix problems on this fairly new platform.
Best Regards
Hi, I have a M1 and CLI works thanks to this discussion, however, GUI still doesnāt work. Is there still no possibility to make GUI work, with display environment ? Thanks !
I am still stuck here :
qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: linuxfb, minimal, offscreen, vnc, xcb.
qemu: uncaught target signal 6 (Aborted) - core dumped```
Hi @Nicolas-Rieu-fr
What command do you use to launch your docker image ?
Do you include those parameters ?
--env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix/:/tmp/.X11-unix/:rw
Note that in order to use this command, you have to install XQuartz according to the README for Mac M1
Let me know if it works
Best regards
Hi thibaut,
Thanks for the answer, here is the error :
(py310) nru@MacBook-Air-de-Nicolas ~ % docker run -it --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix/:/tmp/.X11-unix/:rw --platform=linux/amd64 orfeotoolbox/otb:latest monteverdi
WARNG> Failed to restore window layout!
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
WARNG> QOpenGLWidget: Failed to create context
WARNG> QOpenGLWidget: Failed to create context
WARNG> QOpenGLWidget: Failed to create context
WARNG> QOpenGLWidget: Failed to create context
WARNG> Required OpenGL version '3.0.0' with GLSL version '1.30'.
WARNG> composeAndFlush: QOpenGLContext creation failed
WARNG> composeAndFlush: makeCurrent() failed
WARNG> composeAndFlush: makeCurrent() failed
WARNG> Current OpenGL version is '' supporting OpenGL Shading-Language (GLSL) version ''.
To run at best performances, this application needs, at least, OpenGL version '3.0.0' with GLSL version '1.30'.
The application will automatically switch to a rendering mode which does not make use of OpenGL shaders and GLSL.
If you are running this application under some remote-desktop service, runtime OpenGL and GLSL versions may differ from those running directly on remote platform.
WARNG> Required OpenGL version '3.0.0' with GLSL version '1.30'.
I am not the only one with this.
Looks like it is is unable to access the necessary graphics resources.
Indice 1:
(base) nru@MacBook-Air-de-Nicolas ~ % glxinfo | grep "OpenGL version"
OpenGL version string: 2.1 Metal - 83.1
Indice 2 (from chatGPT):
On a Mac with an M1 chip, the OpenGL version is limited to OpenGL 2.1 because Apple has transitioned to its proprietary Metal graphics framework. Metal is the recommended and primary graphics API for macOS, and Apple has not continued support for newer OpenGL versions. As a result, you cannot directly update the OpenGL version to a higher version on an M1 Mac. Youāre essentially limited to OpenGL 2.1 when using traditional OpenGL. If you have specific software or applications that require a higher OpenGL version, youāll need to check whether those applications have been updated to use Metal or other graphics frameworks compatible with M1-based Macs. Some applications and games have been updated to work with Metal, while others may not be compatible. In summary, updating the OpenGL version on an M1 Mac is not a straightforward process, as Apple has deprecated OpenGL in favor of Metal. Your best course of action is to use software that is compatible with Metal or contact the developers of the software youāre using to inquire about M1 compatibility or any potential updates.
But is that true ?
My hypothese (if it helps) : macOS can potentially support newer versions of OpenGL if the application developers have programmed the application to use them. If an application is designed to utilize a specific version of OpenGL, macOS will attempt to provide a compatible context for that version. However, if the application is not designed for this, it may be limited to OpenGL 2.1, which is the default version supported on Macs with M1 chips.
Best regards,
Nicolas
Hi @Nicolas-Rieu-fr
Thanks for the feedback, unfortunatly Apple totally ditched OpenGL support when releasing Metal, I noticed that Qt 5.15 requires OpenGL 3.0 in Monteverdi, I donāt know why exactly I guess it uses some extensions in OpenGL >= 3.0 to speed up the rendering. Does XQuartz emulates or exposes well OpenGL extensions? I donāt know
I have found some interesting issue, and a tutorial to enable iGlx where they say that : " OpenGL is not enabled in XQuartz by default. Youāll have to do the following one-time configuration"
As X11 is getting deprecated and OpenGL being ditched by Apple in favor of Metal, I think the OTB GUI are not going to work anymore ![:confused: :confused:](https://forum.orfeo-toolbox.org/images/emoji/twitter/confused.png?v=12)
Best regards