简体   繁体   中英

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.

I ran install.packages("stringr") in RStudio and it raised an error. 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.

I have Windows 10 but I do not have admin rights. I have R version 4.0.5. I installed R and RStudio via Anaconda. By the way, it seems that there is an issue with 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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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