如何在脱机Debian机器上安装R软件包? [英] How can I install a R package on a offline Debian machine?
问题描述
我仍然可以使用apt-get命令安装旧版本的R 3.1.1:
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev
但是,在查看列表时仍然找不到闪亮的包:
sudo apt-cache search^ r - 。*|排序
所以,我想我是否可以把shiny.tar.gz VM并在本地安装软件包?我如何离线安装任何R包?
我尝试过一些类似于
install.packages('/ home / mli / R / dir_pkg / shiny / shiny_0.13.2.tar.gz',repos = NULL,type =source)
然而,它没有通过,错误信息如下:
将包安装到'/ usr / local / lib / R / site-library'
(as'lib'未指定)
类型==both中的错误:
比较(1)仅适用于原子和列表类型
调用:install.packages
执行停止
然后,我尝试使用另一个R CMD:
R CMD INSTALL / home / mli / R / dir_pkg /闪光/闪亮0.13.2.tar.gz
我收到错误消息告诉我缺少依赖关系:
*安装到库'/ home / mli / R / x86_64-pc-linux-gnu-library /3.1'
错误:依赖关系'httpuv','mime','jsonlite' 'xtable','digest','htmltools','R6'不可用于包'闪亮'
*删除'/home/mli/R/x86_64-pc-linux-gnu-library/3.1/shiny '
如何从源代码成功安装闪存包?我是否应该首先安装依赖项的所有依赖关系和依赖关系?
Shiny有几个包依赖关系,R CMD INSTALL不会为您找到它们,因此您需要手动获取它们。根据闪存的描述,它的依赖是:
'Rcpp','httpuv','mime','jsonlite','xtable','digest','htmltools','R6'。
首先,从起重机获取软件包(以下是当前版本,但是它们会随着时间的推移而改变)以下注意事项是连接到互联网的计算机,您需要在继续之前将其scp到离线计算机) :
wget https://cran.r-project.org/src/contrib/Rcpp_0.12.4.tar.gz
wget https://cran.r-project.org/src/contrib/httpuv_1.3.3.tar.gz
wget https://cran.r-project.org/src/contrib/mime_0。 4.tar.gz
wget https://cran.r-project.org/src/contrib/jsonlite_0.9.19.tar.gz
wget https://cran.r-project.org/ src / contrib / digest_0.6.9.tar.gz
wget https://cran.r-project.org/src/contrib/htmltools_0.3.5.tar.gz
wget https:// cran。 r-project.org/src/contrib/R6_2.1.2.tar.gz
wget https://cran.r-project.org/src/contrib/shiny_0.13.2.tar.gz
然后用R CMD INSTALL以相同的顺序遍历它们。例如:
R CMD INSTALL Rcpp_0.12.4.tar.gz
一旦所有的依赖项都存在,R CMD INSTALL应该让你安装闪亮。
I have an Debian VM which is not connected to internet. Yet, I can still scp any file from my local machine which does have internet connection. To provide a little bit context, I am trying to host an shiny app on the VM.
I can still install an old version of R 3.1.1 with the "apt-get" command:
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev
Yet, still can't find the "shiny" package when check the list:
sudo apt-cache search "^r-.*" | sort
So, I am thinking whether I could just scp the "shiny.tar.gz" to the VM and install the package locally? How could I install any R package offline?
I have tried somethings like:
install.packages('/home/mli/R/dir_pkg/shiny/shiny_0.13.2.tar.gz', repos = NULL, type = "source")
Yet, it didn't go through and error message as below:
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Error in type == "both" :
comparison (1) is possible only for atomic and list types
Calls: install.packages
Execution halted
Then, I tried it with another "R CMD":
R CMD INSTALL /home/mli/R/dir_pkg/shiny/shiny_0.13.2.tar.gz
I got error message telling me that dependencies is missing:
* installing to library ‘/home/mli/R/x86_64-pc-linux-gnu-library/3.1’
ERROR: dependencies ‘httpuv’, ‘mime’, ‘jsonlite’, ‘xtable’, ‘digest’, ‘htmltools’, ‘R6’ are not available for package ‘shiny’
* removing ‘/home/mli/R/x86_64-pc-linux-gnu-library/3.1/shiny’
How can I successfully install shiny package from source? Should I go ahead to install all dependencies and dependencies of dependencies first?
Shiny has a few package dependencies, and "R CMD INSTALL" won't find them for you, so you need to get them manually. According to the description of shiny, it's dependencies are: 'Rcpp’, ‘httpuv’, ‘mime’, ‘jsonlite’, ‘xtable’, ‘digest’, ‘htmltools’, ‘R6’. So first, get the packages from cran (below are current versions, but they do change over time. Note below is for the computer connected to the internet, you'll need to scp these to the offline computer before continuing):
wget https://cran.r-project.org/src/contrib/Rcpp_0.12.4.tar.gz
wget https://cran.r-project.org/src/contrib/httpuv_1.3.3.tar.gz
wget https://cran.r-project.org/src/contrib/mime_0.4.tar.gz
wget https://cran.r-project.org/src/contrib/jsonlite_0.9.19.tar.gz
wget https://cran.r-project.org/src/contrib/digest_0.6.9.tar.gz
wget https://cran.r-project.org/src/contrib/htmltools_0.3.5.tar.gz
wget https://cran.r-project.org/src/contrib/R6_2.1.2.tar.gz
wget https://cran.r-project.org/src/contrib/shiny_0.13.2.tar.gz
Then go through them in that same order with R CMD INSTALL. eg:
R CMD INSTALL Rcpp_0.12.4.tar.gz
Once all the dependencies are there, R CMD INSTALL should let you install shiny.
这篇关于如何在脱机Debian机器上安装R软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!