remotes icon indicating copy to clipboard operation
remotes copied to clipboard

`install_github()` fails when no write access to site library and no personal library created yet

Open michaelmhoffman opened this issue 5 years ago • 3 comments

R version 3.4.4 (2018-03-15) -- "Someone to Lean On"                                                                                                    
Copyright (C) 2018 The R Foundation for Statistical Computing                                                                                           
Platform: x86_64-pc-linux-gnu (64-bit)                                                                                                                  
                                                                                                                                                        
R is free software and comes with ABSOLUTELY NO WARRANTY.                                                                                               
You are welcome to redistribute it under certain conditions.                                                                                            
Type 'license()' or 'licence()' for distribution details.                                                                                               
                                                                                                                                                        
  Natural language support but running in an English locale                                                                                             
                                                                                                                                                        
R is a collaborative project with many contributors.                                                                                                    
Type 'contributors()' for more information and                                                                                                          
'citation()' on how to cite R or R packages in publications.                                                                                            
                                                                                                                                                        
Type 'demo()' for some demos, 'help()' for on-line help, or                                                                                             
'help.start()' for an HTML browser interface to help.                                                                                                   
Type 'q()' to quit R.                                                                                                                                   
                                                                                                                                                        
> remotes::install_github("serrat839/mRkov")                                                                                                            
Downloading GitHub repo serrat839/mRkov@master                                                                                                          
Skipping 1 packages not available: ISOcodes                                                                                                             
Installing 12 packages: rtweet, tidytext, stopwords, wordcloud, hms, SnowballC, ISOcodes, progress, hunspell, generics, tokenizers, janeaustenr         
Installing packages into ‘/usr/local/lib/R/site-library’                                                                                                
(as ‘lib’ is unspecified)                                                                                                                               
Error: Failed to install 'mRkov' from GitHub:                                                                                                           
  (converted from warning) 'lib = "/usr/local/lib/R/site-library"' is not writable                                                                      
> Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS=TRUE)                                                                                                    
> remotes::install_github("serrat839/mRkov")                                                                                                            
Downloading GitHub repo serrat839/mRkov@master                                                                                                          
Skipping 1 packages not available: ISOcodes                                                                                                             
Installing 12 packages: rtweet, tidytext, stopwords, wordcloud, hms, SnowballC, ISOcodes, progress, hunspell, generics, tokenizers, janeaustenr         
Installing packages into ‘/usr/local/lib/R/site-library’                                                                                                
(as ‘lib’ is unspecified)                                                                                                                               
Warning in i.p(...) :                                                                                                                                   
  'lib = "/usr/local/lib/R/site-library"' is not writable                                                                                               
Would you like to use a personal library instead?  (y/n) y                                                   

...

Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’                          
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’                          
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’                          
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’                          
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’                          
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’                          
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’                          
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’                          
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’                          
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’                          
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’                          
                                                                                                             
The downloaded source packages are in                                                                        
        ‘/tmp/RtmptGS1IL/downloaded_packages’                                                                
✔  checking for file ‘/tmp/RtmptGS1IL/remoteseb878f42ebd/serrat839-mRkov-d29973e/DESCRIPTION’ (574ms)        
─  preparing ‘mRkov’:                                                                                        
✔  checking DESCRIPTION meta-information                                                                     
─  checking for LF line-endings in source and make files and shell scripts                                   
─  checking for empty or unneeded directories                                                                
─  looking to see if a ‘data/datalist’ file should be added                                                  
─  building ‘mRkov_0.0.0.9000.tar.gz’                                                                        
                                                                                                             
Installing package into ‘/usr/local/lib/R/site-library’                                                      
(as ‘lib’ is unspecified)                                                                                    
Warning in i.p(...) :                                                                                        
  'lib = "/usr/local/lib/R/site-library"' is not writable                                                    
Would you like to use a personal library instead?  (y/n) y
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’
There were 13 warnings (use warnings() to see them)

michaelmhoffman avatar May 14 '20 19:05 michaelmhoffman

This seems like a duplicate of https://github.com/r-lib/remotes/issues/431

IMHO this seems like a bug in base R to me, you can reproduce the issue without remotes at all.

jimhester avatar May 14 '20 20:05 jimhester

I was going to close and move to #431 and then I noticed that was already closed.

Base install.packages() offers to create the personal library after warning. When called from remotes it doesn't. That is because remotes sets options(warn=2) so the warning turns into an error.

Even when setting R_REMOTES_NO_ERRORS_FROM_WARNINGS=TRUE it still doesn't work (see transcript above). @cfhammill's explanation in #431 makes sense although I haven't verified it myself.

When there is no personal library created, install.packages("package") creates the personal library and installs there without problem. I did this immediately after reporting this bug. This problem only arises when using remotes and is not a base R issue.

michaelmhoffman avatar May 14 '20 20:05 michaelmhoffman

This problem still exists, and the solution as mentioned in #431 is probably still the same, and still unimplemented.

douglasgscofield avatar Dec 05 '23 13:12 douglasgscofield