gpt4 book ai didi

r - X11 不可用 - Centos

转载 作者:太空宇宙 更新时间:2023-11-03 17:15:55 25 4
gpt4 key购买 nike

我已经在 Centos 服务器上安装了 R 3.3.0。我已经安装了多个软件包,包括 shiny 和进一步安装的 shiny 服务器。我已经加载了我的应用程序文件并且应用程序正在运行。我有一些未呈现的 ggplot,我收到一条错误消息:

X11 不可用

我用谷歌搜索并执行了以下操作:

在 R 控制台中运行 capabilities() 后,我得到以下信息:

jpeg    png tiff    tcltk   X11 aqua
FALSE FALSE FALSE FALSE FALSE FALSE
http/ftp sockets libxml fifo cledit iconv
TRUE TRUE TRUE TRUE FALSE TRUE
NLS profmem cairo ICU long.double libcurl
TRUE FALSE FALSE FALSE TRUE TRUE

我安装了:

yum -y groupinstall "X Window System""Desktop""Fonts""General Purpose Desktop"

yum install cairo-devel
yum install libXt-devel
install.packages("Cairo")
yum install xorg-x11-xauth
yum install xorg-x11-apps

以上所有都已安装,但即使在加载库(开罗)后我仍然遇到相同的错误。

当我在 R 中运行 Sys.getenv("DISPLAY") 时,我得到一个空白 ""

解决方案之一here表示我应该使用 ./configure --with-x=no 重新编译 R。而另一个博客here表明为什么我不应该这样做。我想知道的是:

  1. 有没有我遗漏的可能对我有帮助的解决方案?
  2. 我可以删除 R 并从头开始重新安装吗...(吓到我了,因为我确定以后会发生什么,而且我还花了很多时间设置 shiny-server)
  3. 如果我应该重新编译我该怎么做...将yum install r-base-dev./configure --with-x=no 帮助?

最佳答案

尽管这是一个老问题,而且当您用谷歌搜索时它有一些解决方法,但我发现了一篇关于从源代码构建 R 的帖子,它使这个过程更容易。

先看看Building R from source

你需要在这篇文章中运行的命令可以概括为

yum install epel-release
yum install yum-utils # to make yum-builddep command available

yum-builddep R # this command will install all the dependencies for building R from source
# Then under your R source folder run (I'm using R version 3.2.3, so you will want to change the version number in these commands):
./configure --prefix=/opt/R/3.2.3 --enable-R-shlib --with-blas --with-lapack # you can substitute your own target directory for /opt/R/3.2.3

make
make install

这将在您的 CentOS 机器上成功安装 R。但是,您可以手动安装这些库,而不是让 yum-builddep 为您安装依赖库,因此您可以跳过已有的库。

如果您重新运行 yum-builddep R,您将安装所有依赖项,它们是:

--> Already installed : zlib-devel-1.2.7-17.el7.x86_64
--> Already installed : xz-devel-5.2.2-1.el7.x86_64
--> Already installed : 1:valgrind-devel-3.11.0-24.el7.x86_64
--> Already installed : tre-devel-0.8.0-18.20140228gitc2f5d13.el7.x86_64
--> Already installed : 1:tk-devel-8.5.13-6.el7.x86_64
--> Already installed : texinfo-tex-5.1-4.el7.x86_64
--> Already installed : 2:texlive-collection-latexrecommended-svn25795.0-38.20130427_r30134.el7.noarch
--> Already installed : 1:tcl-devel-8.5.13-8.el7.x86_64
--> Already installed : readline-devel-6.2-9.el7.x86_64
--> Already installed : pcre-devel-8.32-15.el7_2.1.x86_64
--> Already installed : pango-devel-1.36.8-2.el7.x86_64
--> Already installed : openblas-devel-0.2.19-4.el7.x86_64
--> Already installed : ncurses-devel-5.9-13.20130511.el7.x86_64
--> Already installed : libtool-2.4.2-22.el7_3.x86_64
--> Already installed : libtiff-devel-4.0.3-27.el7_3.x86_64
--> Already installed : 2:libpng-devel-1.5.13-7.el7_2.x86_64
--> Already installed : libjpeg-turbo-devel-1.2.90-5.el7.x86_64
--> Already installed : libicu-devel-50.1.2-15.el7.x86_64
--> Already installed : libcurl-devel-7.29.0-35.el7.centos.x86_64
--> Already installed : libXt-devel-1.1.4-6.1.el7.x86_64
--> Already installed : libXmu-devel-1.1.2-2.el7.x86_64
--> Already installed : libX11-devel-1.6.3-3.el7.x86_64
--> Already installed : libSM-devel-1.2.2-2.el7.x86_64
--> Already installed : libICE-devel-1.0.9-2.el7.x86_64
--> Already installed : less-458-9.el7.x86_64
--> Already installed : 1:java-1.8.0-openjdk-headless-1.8.0.131-2.b11.el7_3.x86_64
--> Already installed : gcc-objc-4.8.5-11.el7.x86_64
--> Already installed : gcc-gfortran-4.8.5-11.el7.x86_64
--> Already installed : gcc-c++-4.8.5-11.el7.x86_64
--> Already installed : cairo-devel-1.14.2-1.el7.x86_64
--> Already installed : bzip2-devel-1.0.6-13.el7.x86_64
--> Already installed : automake-1.13.4-3.el7.noarch
--> Already installed : autoconf-2.69-11.el7.noarch

因此,您可以根据当前库的情况选择只安装其中一些库,尤其是如果您已经安装了“开发工具”或其他一些包。

在我的例子中,我安装了 Oracle JDK,所以我不需要通过 yum-builddep 安装 open-jdk,所以我删除了 open-jdk,当我正确设置 JAVA_HOME 时,编译通过了,没有任何错误。

关于r - X11 不可用 - Centos,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38137546/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com