簡體   English   中英

無法在 R 安裝包

[英]Can't install packages in R

[請求同事,因為他的帖子被網站機器人視為垃圾郵件。]

我正在嘗試在stringr上安裝 package stringr。

我在 RStudio 中運行了install.packages("stringr")並引發了錯誤。 然后,我嘗試從終端安裝它,它引發了類似的錯誤,見下文。 我嘗試安裝的任何 package 都會引發同樣的問題。

我有 Windows 10 但我沒有管理員權限。 我有 R 版本 4.0.5。 我通過Anaconda安裝了R和RStudio。順便說一下,Rtools好像有問題。 .Renviron 的內容是PATH="${RTOOLS42_HOME}\usr\bin;${PATH}" (我猜應該是)但是Sys.which("make")在 Rstudio 中返回"" 。最后一件事,我的 R 家庭環境在我的 OneDrive 文件夾中,這可能會導致問題?

任何的想法?

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/')"              

根據錯誤消息中的這些行:

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

這個錯誤:

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

看來您的同事需要更新他們的生命周期和 rlang 包才能安裝 stringr。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM