Cannot use X11 in remote R session, but can in python session?

90 views Asked by At

I want to use R plotting on a remote server. I'm on a mac, I have XQuartz installed, and I am connecting with ssh -X -Y NAME@SERVER (results are the same whether I use just X or Y or both). Once I'm on the remote server I can open xeyes and plot in python with:

import matplotlib.pyplot as plt
plt.plot([1,2],[4,2])
plt.show()

But I can't figure out how to plot in R. When I type x11() I get Error in x11(): X11 is not available. Since I can get an X11 window with python and xeyes, I imagine I'm missing some sort of R package, but I'm at a loss as to what it is. Any help is appreciated!

$ R

R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

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.

> x11()
Error in x11() : X11 is not available
>
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS:   /PATH/TO/Ubuntu18.04/rstats-4.0.3/lib/R/lib/libRblas.so
LAPACK: /PATH/TO/Ubuntu18.04/rstats-4.0.3/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US       LC_NUMERIC=C         LC_TIME=en_US       
 [4] LC_COLLATE=en_US     LC_MONETARY=en_US    LC_MESSAGES=en_US   
 [7] LC_PAPER=en_US       LC_NAME=C            LC_ADDRESS=C        
[10] LC_TELEPHONE=C       LC_MEASUREMENT=en_US LC_IDENTIFICATION=C 

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.0.3
>
>
> capabilities()
       jpeg         png        tiff       tcltk         X11        aqua 
       TRUE        TRUE        TRUE        TRUE       FALSE       FALSE 
   http/ftp     sockets      libxml        fifo      cledit       iconv 
       TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
        NLS     profmem       cairo         ICU long.double     libcurl 
       TRUE       FALSE        TRUE        TRUE        TRUE        TRUE 
$ echo $DISPLAY
SERVER:14.0
0

There are 0 answers