简体   繁体   English

无法在 R 安装包

[英]Can't install packages in R

[Asking for a colleague because his post is considered as a spam by the website bot.] [请求同事,因为他的帖子被网站机器人视为垃圾邮件。]

I am trying to install the package stringr on R.我正在尝试在stringr上安装 package stringr。

I ran install.packages("stringr") in RStudio and it raised an error.我在 RStudio 中运行了install.packages("stringr")并引发了错误。 Then, I try installing it from the terminal and it raised a similar error, see below.然后,我尝试从终端安装它,它引发了类似的错误,见下文。 Any package I try to install raises the same issue.我尝试安装的任何 package 都会引发同样的问题。

I have Windows 10 but I do not have admin rights.我有 Windows 10 但我没有管理员权限。 I have R version 4.0.5.我有 R 版本 4.0.5。 I installed R and RStudio via Anaconda. By the way, it seems that there is an issue with Rtools.我通过Anaconda安装了R和RStudio。顺便说一下,Rtools好像有问题。 The content of.Renviron is PATH="${RTOOLS42_HOME}\usr\bin;${PATH}" (as it should be I guess) but Sys.which("make") returns "" in Rstudio. One last thing, my R home environment is on my OneDrive folder, maybe this causes the issue? .Renviron 的内容是PATH="${RTOOLS42_HOME}\usr\bin;${PATH}" (我猜应该是)但是Sys.which("make")在 Rstudio 中返回"" 。最后一件事,我的 R 家庭环境在我的 OneDrive 文件夹中,这可能会导致问题?

Any idea?任何的想法?

C:\Users\TDOUENN>Rscript -e "install.packages('stringr', repos='https://cran.rstudio.com/')"                            
Installing package into 'C:/Users/TDOUENN/OneDrive - UvA/Documents/My_RLibs'                                            
(as 'lib' is unspecified)                                                                                               
also installing the dependencies 'cli', 'rlang', 'lifecycle'                                                                                                                                                                                                                                                                                                              
There are binary versions available but the source versions are later:                                                          

binary source needs_compilation                                                                               

cli        3.2.0  3.6.0              TRUE                                                                               
rlang      1.0.2  1.0.6              TRUE                                                                              
lifecycle  1.0.1  1.0.3             FALSE                                                                              
stringr    1.4.0  1.5.0             FALSE        

Binaries will be installed                                                                                            

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/cli_3.2.0.zip'                                             
Content type 'application/zip' length 1255499 bytes (1.2 MB)                                                            
==================================================                                                                      
downloaded 1.2 MB                                                                                                                                                                                                                               
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/rlang_1.0.2.zip'                                           
Content type 'application/zip' length 1718546 bytes (1.6 MB)                                                            
==================================================                                                                      
downloaded 1.6 MB                                                                                                                                                                                                                               
package 'cli' successfully unpacked and MD5 sums checked                                                                
package 'rlang' successfully unpacked and MD5 sums checked                                                                                                                                                                                      
The downloaded binary packages are in                                                                                           
C:\Users\TDOUENN\AppData\Local\Temp\RtmpkPFcWJ\downloaded_packages                                              
installing the source packages 'lifecycle', 'stringr'                                                                                                                                                                                           
trying URL 'https://cran.rstudio.com/src/contrib/lifecycle_1.0.3.tar.gz'                                                
Content type 'application/x-gzip' length 106854 bytes (104 KB)                                                          
==================================================                                                                      
downloaded 104 KB                                                                                                                                                                                                                               
trying URL 'https://cran.rstudio.com/src/contrib/stringr_1.5.0.tar.gz'                                                  
Content type 'application/x-gzip' length 175699 bytes (171 KB)                                                          
==================================================                                                                      
downloaded 171 KB                                                                                                                                                                                                                               
* installing *source* package 'lifecycle' ...                                                                           
** package 'lifecycle' successfully unpacked and MD5 sums checked                                                       
** using staged installation                                                                                            
** R                                                                                                                    
** inst                                                                                                                 
** byte-compile and prepare package for lazy loading                                                                    
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :                                              
namespace 'rlang' 1.0.2 is being loaded, but >= 1.0.6 is required                                                     
Calls: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace                         
Execution halted                                                                                                        
ERROR: lazy loading failed for package 'lifecycle'                                                                      
* removing 'C:/Users/TDOUENN/OneDrive - UvA/Documents/My_RLibs/lifecycle'                                               
* installing *source* package 'stringr' ...                                                                             
** package 'stringr' successfully unpacked and MD5 sums checked                                                         
** using staged installation                                                                                            
** R                                                                                                                    
** data                                                                                                                 
*** moving datasets to lazyload DB                                                                                      
** inst                                                                                                                 
** byte-compile and prepare package for lazy loading                                                                    
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :                                   
namespace 'lifecycle' 1.0.0 is being loaded, but >= 1.0.3 is required                                                 
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace                                              
Execution halted                                                                                                        
ERROR: lazy loading failed for package 'stringr'                                                                        
* removing 'C:/Users/TDOUENN/OneDrive - UvA/Documents/My_RLibs/stringr'                                                                                                                                                                         
The downloaded source packages are in                                                                                           
'C:\Users\TDOUENN\AppData\Local\Temp\RtmpkPFcWJ\downloaded_packages'                                            
Warning messages:                                                                                                       
1: In install.packages("stringr", repos = "https://cran.rstudio.com/") :                                                  
installation of package 'lifecycle' had non-zero exit status                                                          
2: In install.packages("stringr", repos = "https://cran.rstudio.com/") :                                                  
installation of package 'stringr' had non-zero exit status                                                                                                                                                                                    
C:\Users\TDOUENN>Rscript -e "install.packages('stringr', repos='https://cran.rstudio.com/')"              

Based on these lines from the error message:根据错误消息中的这些行:

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :                                              
namespace 'rlang' 1.0.2 is being loaded, but >= 1.0.6 is required

And this error:这个错误:

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :                                   
namespace 'lifecycle' 1.0.0 is being loaded, but >= 1.0.3 is required                                                 
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace                                              
Execution halted

It looks like your colleague needs to update their lifecycle and rlang packages in order to install stringr.看来您的同事需要更新他们的生命周期和 rlang 包才能安装 stringr。

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

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