我在ubuntu服务器上安装了闪亮的服务器。我在开发服务器上做了类似的安装工作。当他们打开R会话加载一些包。该应用程序在本地运行正常,但我收到的消息是,它在发光服务器上运行时找不到包。
应用上的错误
During startup - Warning messages:
1: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘shiny’
2: package ‘shiny’ in options("defaultPackages") was not found
3: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘data.table’
4: package ‘data.table’ in options("defaultPackages") was not found
5: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘optiRum’
6: package ‘optiRum’ in options("defaultPackages") was not found
Error in eval(expr, envir, enclos) :
The Shiny package was not found in the library. Ensure that
Shiny is installed and is available in the Library of the
user you're running this application as.
Calls: local -> eval.parent -> eval -> eval -> eval -> eval
Execution halted
在Rprofile.site中我有
# ## Example of Rprofile.site
local({
# # add MASS to the default packages, set a CRAN mirror
old <- getOption("defaultPackages"); r <- getOption("repos")
# r["CRAN"] <- "http://my.local.cran"
options(defaultPackages = c(old, "shiny","data.table","optiRum"), repos = r)
})
.First <- function() {
cat("\n Welcome to R!\n\n")
# setwd("/home/OPTIMUMCREDIT/R/Projects")
Sys.umask(mode="0002")
}
.libPaths(c("/home/R/WorkingPackages","/home/R/ApprovedPackages"))
在闪亮的服务器配置中,我只有默认配置(因此运行为闪亮和默认端口)。
我的sessionInfo()
> sessionInfo()
R version 3.0.3 (2014-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C LC_PAPER=C
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_0.9.3.1 scales_0.2.3 RCurl_1.95-4.1 bitops_1.0-6 rstudio_0.98.501 optiRum_0.30 data.table_1.9.2 shiny_0.8.0
loaded via a namespace (and not attached):
[1] MASS_7.3-29 RColorBrewer_1.0-5 RJSONIO_1.0-3 Rcpp_0.11.0 caTools_1.16 colorspace_1.2-4 dichromat_2.0-0
[8] digest_0.6.4 grid_3.0.3 gtable_0.1.2 httpuv_1.2.3 labeling_0.2 munsell_0.4.2 plyr_1.8.1
[15] proto_0.3-10 reshape2_1.2.2 stringr_0.6.2 tools_3.0.3 xtable_1.7-3
我尝试在代码中添加一条消息来输出library(shiny)
上面的libPaths,但遗憾的是发生了相同的错误消息。我做了一些卸载和重新安装,因为我有点不寻常地安装了闪亮的服务器,然后记得我需要闪亮但没有快乐。我已经确认在ApprovedPackages中安装了闪亮。加载的软件包,我希望能够绕过这个问题或者找到更多的信息。
更新 - 以闪亮的方式运行 啊 - 情节变浓了......用户在控制台上闪亮登录会导致应用程序获得相同的警告,并且.libPaths()与其他人不一样:
> sessionInfo()
R version 3.0.3 (2014-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
> .libPaths()
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"
[3] "/usr/lib/R/library"
我有点难过,并希望有人能指出我正确的方向来解决问题。
答案 0 :(得分:13)
对不起烦恼。您可以尝试运行以下命令来安装Shiny系统范围吗?
sudo su - \
-c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""
这来自Admin Guide,它(希望)将成为这类问题的有用资源。
我怀疑问题是Shiny确实已正确安装在您的用户帐户中,但由于它未安装为sudo,因此<{1}}用户无法 。< / p>
编辑:
当shiny
用户启动R进程时,您还需要确保正在应用Rprofile.site
。您可以登录shiny
:
shiny
然后打开R并检查sudo su shiny
或查看是否可以在那里成功运行.libPaths()
。如果您无法做到,那么让library(shiny)
用户进入您的共享包目录或您的shiny
文件(或其父目录)可能存在问题。确保将Rprofile.site
用户添加到必要的组中,或者这些文件及其所有父目录为shiny
用户授予适当的权限。