@创建于:2024.5.5
文章目录
- 1. 报错信息
- 2. 尝试使用指定的清华镜像,没有解决
- 3. 找到原因:官网把包删除了
- 4. 尝试从网上下载,然后安装。没有成功
- 5. 使用devtools安装
- 5.1 尝试直接安装:install.packages("devtools", type = "win.binary")
- 5.2 不存在叫‘shiny’这个名字的程辑包:
- 5.3 不存在叫‘htmlwidgets’这个名字的程辑包
在R的 RGui中,使用devtools 安装trajeR。
背景信息
window 64bit,R version 4.1.0 (2021-05-18) 。
在R的Gui中(以管理员身份打开),尝试安装trajeR包。
1. 报错信息
报错信息如下:
> install.packages("trajeR")
将程序包安装入‘C:/Users/chen_/Documents/R/win-library/4.1’
(因为‘lib’没有被指定)
Warning message:
package ‘trajeR’ is not available for this version of RA version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
2. 尝试使用指定的清华镜像,没有解决
使用下面两种方式,还是无法安装trajeR包。
# 方式 1
options(repos=structure(c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")))
install.packages("trajeR")# 方式 2
install.packages("trajeR", repos="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")
3. 找到原因:官网把包删除了
2024.5.5,在官网发现如下信息:
https://cran.r-project.org/web/packages/trajeR/index.html
Package ‘trajeR’ was removed from the CRAN repository.
Formerly available versions can be obtained from the archive.
Archived on 2024-01-12 as issues were not corrected despite reminders.
A summary of the most recent check results can be obtained from the
check results archive.Please use the canonical form
https://CRAN.R-project.org/package=trajeR to link to this page.
4. 尝试从网上下载,然后安装。没有成功
download.file("https://cran.r-project.org/src/contrib/Archive/trajeR/trajeR_0.9.0.5.tar.gz", "trajeR_0.9.0.5.tar.gz ")
install.packages("trajeR_0.9.0.5.tar.gz",repos=NULL)
参考链接:总结一下手动安装R包
> download.file("https://cran.r-project.org/src/contrib/Archive/trajeR/trajeR_0.9.0.5.tar.gz", "trajeR_0.9.0.5.tar.gz")
试开URL’https://cran.r-project.org/src/contrib/Archive/trajeR/trajeR_0.9.0.5.tar.gz'
Content length 181106 bytes (176 KB)
downloaded 176 KB> install.packages("trajeR_0.9.0.5.tar.gz",repos=NULL)
将程序包安装入‘C:/Users/chen_/Documents/R/win-library/4.1’
(因为‘lib’没有被指定)
ERROR: dependencies 'minpack.lm', 'ucminf', 'capushe', 'RcppArmadillo' are not available for package 'trajeR'
* removing 'C:/Users/chen_/Documents/R/win-library/4.1/trajeR'
Warning message:
In install.packages("trajeR_0.9.0.5.tar.gz", repos = NULL) :installation of package ‘trajeR_0.9.0.5.tar.gz’ had non-zero exit status
5. 使用devtools安装
# 下面这个命令可以安装成功,省略type无法安装成功
install.packages("devtools", type = "win.binary")
# library(devtools)的时候,总是提示包缺少,不得不继续安装shiny,htmlwidgets这两个包
install.packages("shiny")
install.packages("htmlwidgets", type = "win.binary")library(devtools)install_url("https://cran.r-project.org/src/contrib/Archive/trajeR/trajeR_0.9.0.5.tar.gz")
install_github("https://cran.r-project.org/src/contrib/Archive/trajeR/trajeR_0.9.0.5.tar.gz")
参考链接:
详解R包devtools,直接从github安装包
R包从CRAN移除了怎么办
install.packages(“devtools”, type = “win.binary”)
安装devtools包,试试这个方法
5.1 尝试直接安装:install.packages(“devtools”, type = “win.binary”)
我的环境中,没有devtools包,所以需要安装。注意,devtools包安装过程中,需要很多依赖。还容易报错。
* DONE (remotes)
ERROR: dependency 'httr2' is not available for package 'gh'
* removing 'C:/Users/chen_/Documents/R/win-library/4.1/gh'
ERROR: dependency 'bslib' is not available for package 'shiny'
* removing 'C:/Users/chen_/Documents/R/win-library/4.1/shiny'
ERROR: dependencies 'bslib', 'knitr' are not available for package 'rmarkdown'
* removing 'C:/Users/chen_/Documents/R/win-library/4.1/rmarkdown'
ERROR: dependencies 'knitr', 'rmarkdown' are not available for package 'htmlwidgets'
* removing 'C:/Users/chen_/Documents/R/win-library/4.1/htmlwidgets'
ERROR: dependency 'gh' is not available for package 'usethis'
* removing 'C:/Users/chen_/Documents/R/win-library/4.1/usethis'
ERROR: dependencies 'bslib', 'rmarkdown' are not available for package 'pkgdown'
* removing 'C:/Users/chen_/Documents/R/win-library/4.1/pkgdown'The downloaded source packages are in‘C:\Users\chen_\AppData\Local\Temp\RtmpYNGYkC\downloaded_packages’
Warning messages:
1: In install.packages("devtools") :installation of package ‘httr2’ had non-zero exit status
2: In install.packages("devtools") :installation of package ‘bslib’ had non-zero exit status
3: In install.packages("devtools") :installation of package ‘knitr’ had non-zero exit status
4: In install.packages("devtools") :installation of package ‘pkgload’ had non-zero exit status
5: In install.packages("devtools") :installation of package ‘gh’ had non-zero exit status
6: In install.packages("devtools") :installation of package ‘shiny’ had non-zero exit status
7: In install.packages("devtools") :installation of package ‘rmarkdown’ had non-zero exit status
8: In install.packages("devtools") :installation of package ‘htmlwidgets’ had non-zero exit status
9: In install.packages("devtools") :installation of package ‘usethis’ had non-zero exit status
10: In install.packages("devtools") :installation of package ‘pkgdown’ had non-zero exit status
>
> system.file(package="devtools")
[1] "C:/Users/chen_/Documents/R/win-library/4.1/devtools"
>
> library(devtools)
错误: 找不到‘devtools’所需要的程辑包‘usethis’
此外: Warning message:
程辑包‘devtools’是用R版本4.1.3 来建造的
install.packages("devtools", type = "win.binary")试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.1/devtools_2.4.5.zip'
Content length 434938 bytes (424 KB)
downloaded 424 KBpackage ‘httr2’ successfully unpacked and MD5 sums checked
package ‘knitr’ successfully unpacked and MD5 sums checked
package ‘gh’ successfully unpacked and MD5 sums checked
package ‘bslib’ successfully unpacked and MD5 sums checked
package ‘rmarkdown’ successfully unpacked and MD5 sums checked
package ‘usethis’ successfully unpacked and MD5 sums checked
package ‘pkgdown’ successfully unpacked and MD5 sums checked
package ‘pkgload’ successfully unpacked and MD5 sums checked
package ‘devtools’ successfully unpacked and MD5 sums checkedThe downloaded binary packages are inC:\Users\chen_\AppData\Local\Temp\RtmpYNGYkC\downloaded_packages
5.2 不存在叫‘shiny’这个名字的程辑包:
> library(devtools)
载入需要的程辑包:usethis
错误: package or namespace load failed for ‘devtools’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):不存在叫‘shiny’这个名字的程辑包
此外: Warning messages:
1: 程辑包‘devtools’是用R版本4.1.3 来建造的
2: 程辑包‘usethis’是用R版本4.1.3 来建造的 > install.packages("shiny")
将程序包安装入‘C:/Users/chen_/Documents/R/win-library/4.1’
(因为‘lib’没有被指定)
5.3 不存在叫‘htmlwidgets’这个名字的程辑包
> library(devtools)
错误: package or namespace load failed for ‘devtools’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):不存在叫‘htmlwidgets’这个名字的程辑包
此外: Warning message:
程辑包‘devtools’是用R版本4.1.3 来建造的
>
>
> install.packages("htmlwidgets", type = "win.binary")
将程序包安装入‘C:/Users/chen_/Documents/R/win-library/4.1’
(因为‘lib’没有被指定)有二进制版本(将被安装),但源代码版本是后来的:binary source
htmlwidgets 1.6.2 1.6.4试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.1/htmlwidgets_1.6.2.zip'
Content length 811157 bytes (792 KB)
downloaded 792 KBpackage ‘htmlwidgets’ successfully unpacked and MD5 sums checkedThe downloaded binary packages are inC:\Users\chen_\AppData\Local\Temp\RtmpYNGYkC\downloaded_packages
>
>
> library(devtools)
Warning message:
程辑包‘devtools’是用R版本4.1.3 来建造的
>