rocker-org / rocker-versioned

Run current & prior versions of R using docker
https://hub.docker.com/r/rocker/r-ver
GNU General Public License v2.0
297 stars 169 forks source link

Request: Please add 'libxt6' package in rocker/r-ver #218

Closed toshi-ara closed 4 years ago

toshi-ara commented 4 years ago

I tried to use rocker/** images in command-line (not RStudio), but failed to plot because of a lack of libXt.so.6 library. I succeeded to plot by adding libxt6 package to rocker/r-ver image as below.

Please add 'libxt6' package in Dockerfile of rocker/r-ver.

without libxt6

$ docker run --rm -it\
  -u `id -u`:`id -g` \
  -e DISPLAY=$DISPLAY \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  rocker/r-ver R

R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

(omit)

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> boxplot(iris$Sepal.Length ~ iris$Species)
Error in (function (display = "", width, height, pointsize, gamma, bg,  : 
  X11 module cannot be loaded
In addition: Warning message:
In grSoftVersion() :
  unable to load shared object '/usr/local/lib/R/modules//R_X11.so':
  libXt.so.6: cannot open shared object file: No such file or directory

with libxt6

I made Dockerfile

FROM rocker/r-ver:latest
RUN apt-get update && apt-get install -y libxt6

and build a new docker image.

docker build -t newimage .

Then,

$ docker run --rm -it \
  -u `id -u`:`id -g` \
  -e DISPLAY=$DISPLAY \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  newimage R

(omit)

> boxplot(iris$Sepal.Length ~ iris$Species)

I succeeded to plot.

eddelbuettel commented 4 years ago

(Just for the record the command above of course also works with the r-base container which has complete libs. The post-compilation cleanup for r-ver must be overzealous and deletes one package too many...)

toshi-ara commented 4 years ago

Thank you for reply. I confirmed rocker/r-base container and succeeded to plot.

I understand that this change will affect many container. If possible, please include in the next version of r-ver.

cboettig commented 4 years ago

@toshi-ara Thanks for the bug report. Supporting X11 is difficult, particularly on non-Linux hosts. (Though as per your example this seems to have gotten a lot better on Docker than when I last tried 4 years ago -- check out the config options we needed then! https://github.com/rocker-org/rocker-versioned/tree/master/X11)

Maybe it's worth adding xt6 if a DISPLAY and the right socket link are all that are needed now...

toshi-ara commented 4 years ago

Thank you for comment. I understand the difficulty of supporting X11.