r-错误:"tidyverse"的包或命名空间加载失败



我看到其他人也有同样的问题,但他们的修复对我不起作用。

当我下载tidyverse:

install.packages("jsonlite", type = "source")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/laura/OneDrive/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/jsonlite_1.7.1.tar.gz'
Content type 'application/x-gzip' length 1057786 bytes (1.0 MB)
downloaded 1.0 MB
* installing *source* package 'jsonlite' ...
** package 'jsonlite' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
c:/Rtools/mingw_32/bin/gcc  -I"C:/PROGRA~1/R/R-35~1.3/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O3 -Wall  -std=gnu99 -mtune=generic -c base64.c -o base64.o
sh: c:/Rtools/mingw_32/bin/gcc: No such file or directory
make: *** [C:/PROGRA~1/R/R-35~1.3/etc/i386/Makeconf:208: base64.o] Error 127
ERROR: compilation failed for package 'jsonlite'
* removing 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/jsonlite'
* restoring previous 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/jsonlite'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘jsonlite’ had non-zero exit status
The downloaded source packages are in
‘C:UserslauraAppDataLocalTempRtmpO6mvhPdownloaded_packages’
> install.packages("tidyverse")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/laura/OneDrive/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘rlang’, ‘tidyselect’, ‘vctrs’, ‘dplyr’, ‘broom’, ‘dbplyr’, ‘modelr’

There are binary versions available but the source versions are later:
binary source needs_compilation
rlang       0.4.5  0.4.9              TRUE
tidyselect  1.0.0  1.1.0              TRUE
vctrs       0.2.4  0.3.5              TRUE
dplyr       0.8.5  1.0.2              TRUE
broom       0.5.6  0.7.2             FALSE
dbplyr      1.4.3  2.0.0             FALSE
modelr      0.1.6  0.1.8             FALSE
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/tidyverse_1.3.0.zip'
Content type 'application/zip' length 439648 bytes (429 KB)
downloaded 429 KB
package ‘tidyverse’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:UserslauraAppDataLocalTempRtmpO6mvhPdownloaded_packages
installing the source packages ‘rlang’, ‘tidyselect’, ‘vctrs’, ‘dplyr’, ‘broom’, ‘dbplyr’, ‘modelr’
trying URL 'https://cran.rstudio.com/src/contrib/rlang_0.4.9.tar.gz'
Content type 'application/x-gzip' length 865299 bytes (845 KB)
downloaded 845 KB
trying URL 'https://cran.rstudio.com/src/contrib/tidyselect_1.1.0.tar.gz'
Content type 'application/x-gzip' length 90842 bytes (88 KB)
downloaded 88 KB
trying URL 'https://cran.rstudio.com/src/contrib/vctrs_0.3.5.tar.gz'
Content type 'application/x-gzip' length 1055792 bytes (1.0 MB)
downloaded 1.0 MB
trying URL 'https://cran.rstudio.com/src/contrib/dplyr_1.0.2.tar.gz'
Content type 'application/x-gzip' length 935654 bytes (913 KB)
downloaded 913 KB
trying URL 'https://cran.rstudio.com/src/contrib/broom_0.7.2.tar.gz'
Content type 'application/x-gzip' length 616998 bytes (602 KB)
downloaded 602 KB
trying URL 'https://cran.rstudio.com/src/contrib/dbplyr_2.0.0.tar.gz'
Content type 'application/x-gzip' length 534910 bytes (522 KB)
downloaded 522 KB
trying URL 'https://cran.rstudio.com/src/contrib/modelr_0.1.8.tar.gz'
Content type 'application/x-gzip' length 121333 bytes (118 KB)
downloaded 118 KB
* installing *source* package 'rlang' ...
** package 'rlang' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
c:/Rtools/mingw_32/bin/gcc  -I"C:/PROGRA~1/R/R-35~1.3/include" -DNDEBUG -I./lib/         -O3 -Wall  -std=gnu99 -mtune=generic -c capture.c -o capture.o
sh: c:/Rtools/mingw_32/bin/gcc: No such file or directory
make: *** [C:/PROGRA~1/R/R-35~1.3/etc/i386/Makeconf:208: capture.o] Error 127
ERROR: compilation failed for package 'rlang'
* removing 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/rlang'
* restoring previous 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/rlang'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘rlang’ had non-zero exit status
* installing *source* package 'vctrs' ...
** package 'vctrs' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
c:/Rtools/mingw_32/bin/gcc  -I"C:/PROGRA~1/R/R-35~1.3/include" -DNDEBUG          -O3 -Wall  -std=gnu99 -mtune=generic -c altrep-rle.c -o altrep-rle.o
sh: c:/Rtools/mingw_32/bin/gcc: No such file or directory
make: *** [C:/PROGRA~1/R/R-35~1.3/etc/i386/Makeconf:208: altrep-rle.o] Error 127
ERROR: compilation failed for package 'vctrs'
* removing 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/vctrs'
* restoring previous 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/vctrs'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘vctrs’ had non-zero exit status
* installing *source* package 'tidyselect' ...
** package 'tidyselect' successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
namespace 'rlang' 0.4.5 is being loaded, but >= 0.4.6 is required
ERROR: lazy loading failed for package 'tidyselect'
* removing 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/tidyselect'
* restoring previous 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/tidyselect'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘tidyselect’ had non-zero exit status
* installing *source* package 'dplyr' ...
** package 'dplyr' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
c:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-35~1.3/include" -DNDEBUG          -O2 -Wall  -mtune=generic -c filter.cpp -o filter.o
sh: c:/Rtools/mingw_32/bin/g++: No such file or directory
make: *** [C:/PROGRA~1/R/R-35~1.3/etc/i386/Makeconf:215: filter.o] Error 127
ERROR: compilation failed for package 'dplyr'
* removing 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/dplyr'
* restoring previous 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/dplyr'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘dplyr’ had non-zero exit status
* installing *source* package 'broom' ...
** package 'broom' successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
namespace 'dplyr' 0.8.5 is being loaded, but >= 1.0.0 is required
ERROR: lazy loading failed for package 'broom'
* removing 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/broom'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘broom’ had non-zero exit status
* installing *source* package 'dbplyr' ...
** package 'dbplyr' successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Error : object 'relocate' is not exported by 'namespace:dplyr'
ERROR: lazy loading failed for package 'dbplyr'
* removing 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/dbplyr'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘dbplyr’ had non-zero exit status
ERROR: dependency 'broom' is not available for package 'modelr'
* removing 'C:/Users/laura/OneDrive/Documents/R/win-library/3.5/modelr'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘modelr’ had non-zero exit status

然后在尝试上传时:

library(tidyverse)

错误:中"tidyverse"的包或命名空间加载失败loadNamespace(j<-i[[1L]],c(lib.loc,.libPaths(((,版本检查=vI[[j]](:没有一个包被称为"扫帚">

我不确定为什么会发生这种情况,我下载了它要求的rtools。。。但不确定我是否用对了。

问题是,尽管没有安装R Tools,但由发出信号

警告:生成R包需要Rtools,但当前尚未安装。在进行之前,请下载并安装适当版本的Rtools

R仍在尝试使用它,当R找不到它时安装失败-发出信号

sh:c:/Rtools/mingw_32/bin/gcc:没有这样的文件或目录

因此,解决方案是安装R Tools,然后再次尝试安装。

最新更新