GUI on non-Linux, e.g. macOS
rdzman opened this issue ยท 7 comments
Thanks, Kai for these Docker images. It's so useful to have all of these versions available for testing.
My goal is to make my own Octave package available with a GUI Octave in a Docker image that can be used easily on multiple OS's. I normally work on macOS and have not been able to get your GUI to work there. If you know how to make it work on macOS and Windows, I'd appreciate step-by-step instructions.
If not, I was wondering if you might consider the approach taken by compdatasci/octave-desktop. That's what I have been using, but unfortunately, it's stuck at Octave 4.2.1. They make the GUI available anywhere via a VNC connection, so you wouldn't have to have X11 installed.
Thanks for the pointer. Your general hope is to avoid installing x11 on your host system (macOS, MS Windows) by using a VNC client?
The mentioned approach seems to be based on x11vnc/x11vnc-desktop. I do not think requiring Python to be installed is an "easy" requirement.
Another interesting tutorial was this one:
However, adding this feature might take more time and testing. This will not happen very soon, PRs are always appreciated ๐
The end goal is just a simple set of instructions for Windows, Mac and Linux users to be able to access the Octave GUI for running my Octave package in a Docker image. The VNC client approach based on x11vnc/x11vnc-desktop worked fine, but I'm happy to use X11 if I can get it working.
I do have X11 (XQuartz) installed on my Mac, and I can open an xterm successfully, but was not able to figure out how to get your Docker image to work with it. Using the command from the README.md ...
docker run \
--rm \
--network=host \
--env="DISPLAY" \
--env="XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" \
--env="NB_USER=$USER" \
--env="NB_UID=$(id -u)" \
--env="NB_GID=$(id -g)" \
--env="GRANT_SUDO=yes" \
--user root \
--volume="$HOME:$HOME:rw" \
--volume="/dev:/dev:rw" \
--volume="/run/user:/run/user:rw" \
docker.io/gnuoctave/octave:6.4.0 start.sh octave --gui
... results in the following output:
Entered start.sh with args: start.sh octave --gui
Updated the jovyan user:
- username: jovyan -> ray
- home dir: /home/jovyan -> /home/ray
Update ray's UID:GID to 501:20
userdel: group ray not removed because it is not the primary group of user ray.
Attempting to copy /home/jovyan to /home/ray...
Success!
Changing working directory to /home/ray/
Granting ray passwordless sudo rights!
Running as ray: start.sh octave --gui
Entered start.sh with args: octave --gui
WARNING: container must be started as root to grant sudo permissions!
Executing the command: octave --gui
octave: unable to open X11 DISPLAY
octave: disabling GUI features
Any suggestions to help me get this working would be great.
Nevermind ... I'm making progress. Appears my trouble was related to needing a hostname in the DISPLAY variable and getting X11 permissions set right. I'll figure that out.
I'm now able to get the GUI to open (still need to figure out something more secure than just turning off authentication though ๐), but plotting is not working. I just get an empty figure window. I suspect it may be related to graphics drivers. Here is the output when I fire up the container with Octave GUI.
Entered start.sh with args: start.sh octave --gui
Updated the jovyan user:
- username: jovyan -> ray
- home dir: /home/jovyan -> /home/ray
Update ray's UID:GID to 501:20
userdel: group ray not removed because it is not the primary group of user ray.
Attempting to copy /home/jovyan to /home/ray...
Success!
Changing working directory to /home/ray/
Granting ray passwordless sudo rights!
Running as ray: start.sh octave --gui
Entered start.sh with args: octave --gui
WARNING: container must be started as root to grant sudo permissions!
Executing the command: octave --gui
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-ray'
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Any ideas about addressing the libGL errors?
@rdzman Finally I got a MacBook Air for testing a bit and mostly I followed this tutorial
https://gist.github.com/sorny/969fe55d85c9b0035b0109a31cbcb088
with
--env="DISPLAY=your.ip.address.here:0"
and got the GUI to work ๐
However, as you wrote, one has to turn off authentication xhost +
to make this magic happen (thus maybe not that much progress).
Regarding the problem with qt plotting. An ugly workaround is using graphics_toolkit gnuplot
:
Also how to properly start the container with admin rights on macOS is still a riddle to me. Maybe you know more about macOS?
I also suspect that many problems are rooted in those errors I also see:
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
However tweaks I tested did not solve it,
Thanks @siko1056, the graphics_toolkit gnuplot
is a work-around for plotting for the time being.
I'm afraid I also was not able to solve the libGL issues. I even tried reverting to Xquartz 2.7.11 with no success.
And I'm afraid I don't have any clues about properly starting the container with admin rights either ... I thought --user root
in the docker run
command should have been enough.
Anyway, thanks again for your help here. Feel free to close this issue, unless you want to leave it open for your own reasons.