简体   繁体   English

闪亮的服务器发生错误加载命名空间时没有软件包rcpp,但是安装了rcpp并在R中加载了闪亮的作品

[英]shiny server an error has occured load namespace no package rcpp but rcpp is installed and loading shiny in R works

I was recently trying to open a shiny server app on my server and got this error which I have never seen before. 我最近试图在服务器上打开一个闪亮的服务器应用程序,但遇到了从未见过的错误。

   Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck     = vI[[j]]) : 
      there is no package called ‘Rcpp’
    Error: package or namespace load failed for ‘shiny’
    Execution halted

I am assuming an update broke something. 我假设更新损坏了某些东西。 However when starting R on my machine both library(shiny) as well as library(Rcpp) load without any issues. 但是,在我的计算机上启动R时, library(shiny)library(Rcpp)加载没有问题。

So I tried re-installing shiny-server. 因此,我尝试重新安装Shiny-server。 According to their instructions here , however I basically get the same error as above: 根据他们在这里的指示,但是我基本上得到了与上面相同的错误:

sudo su - \
> -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""

R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
Copyright (C) 2015 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.

> install.packages('shiny', repos='http://cran.rstudio.com/')
Installing package into â/usr/local/lib/R/site-libraryâ
(as âlibâ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/shiny_0.12.1.tar.gz'
Content type 'application/x-gzip' length 1473559 bytes (1.4 MB)
==================================================
downloaded 1.4 MB

* installing *source* package âshinyâ ...
** package âshinyâ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
  there is no package called âRcppâ
ERROR: lazy loading failed for package âshinyâ
* removing â/usr/local/lib/R/site-library/shinyâ
* restoring previous â/usr/local/lib/R/site-library/shinyâ

The downloaded source packages are in
        â/tmp/RtmpUfc19u/downloaded_packagesâ
Warning message:
In install.packages("shiny", repos = "http://cran.rstudio.com/") :
  installation of package âshinyâ had non-zero exit status

I have no idea why this is, since both shiny and Rcpp install and load flawlessy when just starting R or even when starting R as sudo. 我不知道为什么会这样,因为仅在启动R或什至在以sudo的身份启动R时,Shiny和Rcpp都可以完美安装和加载。

My sessionInfo() output is: 我的sessionInfo()输出是:

R version 3.2.1 (2015-06-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] shiny_0.12.1 Rcpp_0.11.6

loaded via a namespace (and not attached):
[1] R6_2.0.1        htmltools_0.2.6 digest_0.6.8    xtable_1.7-4
[5] httpuv_1.3.2    mime_0.3

Thanks in advance for any pointers or help. 在此先感谢您提供任何指示或帮助。

Apparently, it was a library/permissions issue. 显然,这是图书馆/许可问题。 I am still a bit foggy on R package managment and all the possible different library locations (certainly when working with Rstudio server and shiny server and bioconductor etc.) and when or not to use sudo to install packages. 我仍然对R软件包管理以及所有可能的不同库位置(一定是在使用Rstudio服务器,闪亮的服务器和生物导体等时)以及何时不使用sudo安装软件包感到困惑。 Any good guidelines on that would probably have avoided this question. 对此的任何良好指导原则都可能避免了这个问题。

The code suggested by the people at Rstudio ( sudo su -\\ -c "R -e \\"install.packages('shiny', repos='http://cran.rstudio.com/')\\"" ) got me thinking: when I run just R in the terminal or sudo R the library(Rcpp) and library(shiny) work so I just did sudo su and then ran R interactively with install.packages('shiny', repos='http://cran.rstudio.com/') . Rstudio的工作人员建议的代码( sudo su -\\ -c "R -e \\"install.packages('shiny', repos='http://cran.rstudio.com/')\\"" su- sudo su -\\ -c "R -e \\"install.packages('shiny', repos='http://cran.rstudio.com/')\\"" )让我思考:当我仅在终端中运行R或sudo Rlibrary(Rcpp)library(shiny)工作,因此我只做了sudo su ,然后与install.packages('shiny', repos='http://cran.rstudio.com/') This showed that apparently for the root user (su) the Rcpp package was not installed (!). 这表明显然对于根用户(su),未安装Rcpp软件包(!)。 After manually installing the package I could also re-install shiny and my shiny app started working again. 手动安装软件包后,我也可以重新安装Shiny,我的Shiny应用程序又可以开始工作了。

What concerns me still about this is how the Rcpp package "dissappeared" in the first place from the root R packages. 我仍然担心的是, Rcpp程序包是如何从根R程序包中“消失”的。 I cannot remember removing it myself and would find it rather unpleasant behavior if an update would have caused this. 我不记得自己删除它,并且如果有更新会导致它不愉快的行为。

Either way: the issue is resolved. 两种方式:解决问题。 Maybe this answer can help others with a similar issue. 也许这个答案可以帮助其他有类似问题的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM