r-lib / remotes

Install R packages from GitHub, GitLab, Bitbucket, git, svn repositories, URLs
https://remotes.r-lib.org/
Other
331 stars 152 forks source link

Warning: the 'wininet' method is deprecated for http:// and https:// URLs #687

Closed hsbadr closed 2 years ago

hsbadr commented 2 years ago

R-devel on Windows:

Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
  the 'wininet' method is deprecated for http:// and https:// URLs
gaborcsardi commented 2 years ago

For what version of remotes?

hsbadr commented 2 years ago

For what version of remotes?

packageVersion("remotes")
[1] ‘2.4.2’

remotes::install_cran("lifecycle", force = TRUE)
Installing 1 packages: lifecycle
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/lifecycle_1.0.1.zip'
Content type 'application/zip' length 122814 bytes (119 KB)
downloaded 119 KB

package ‘lifecycle’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in C:\Users\hsbadr\AppData\Local\Temp\RtmpWwmRkI\downloaded_packages Warning message: In download.file(url, destfile, method, mode = "wb", ...) : the 'wininet' method is deprecated for http:// and https:// URLs

hsbadr commented 2 years ago

Sure, this can be addressed by setting the download.file.method option:

> options(download.file.method = "auto")
> remotes::install_cran("lifecycle", force = TRUE)
Installing 1 packages: lifecycle
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/lifecycle_1.0.1.zip'
Content length 122814 bytes (119 KB)
downloaded 119 KB

package ‘lifecycle’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\hsbadr\AppData\Local\Temp\RtmpWwmRkI\downloaded_packages

Though, you probably want to avoid using the deprecated 'wininet' method by default.

hsbadr commented 2 years ago
> R.version
               _                                                      
platform       x86_64-w64-mingw32                                     
arch           x86_64                                                 
os             mingw32                                                
crt            ucrt                                                   
system         x86_64, mingw32                                        
status         Under development (unstable)                           
major          4                                                      
minor          2.0                                                    
year           2022                                                   
month          01                                                     
day            14                                                     
svn rev        81498                                                  
language       R                                                      
version.string R Under development (unstable) (2022-01-14 r81498 ucrt)
nickname       Unsuffered Consequences
hsbadr commented 2 years ago
> options(warn = 2)
> remotes::install_cran("lifecycle", force = TRUE)
Installing 1 packages: lifecycle
Error in download.file(url, destfile, method, mode = "wb", ...) : 
  (converted from warning) the 'wininet' method is deprecated for http:// and https:// URLs
Error: Failed to install 'lifecycle' from CRAN:
  (converted from warning) download of package ‘lifecycle’ failed
> traceback()
7: stop(remote_install_error(remotes[[i]], e))
6: value[[3L]](cond)
5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
4: tryCatchList(expr, classes, parentenv, handlers)
3: tryCatch(res[[i]] <- install_remote(remotes[[i]], ...), error = function(e) {
       stop(remote_install_error(remotes[[i]], e))
   })
2: install_remotes(remotes, dependencies = dependencies, upgrade = upgrade, 
       force = force, quiet = quiet, build = build, build_opts = build_opts, 
       build_manual = build_manual, build_vignettes = build_vignettes, 
       repos = repos, type = type, ...)
1: remotes::install_cran("lifecycle", force = TRUE)
hsbadr commented 2 years ago

@gaborcsardi It seems that this is related to RStudio. It doesn't happen in R console.

gaborcsardi commented 2 years ago

The current version of remotes does not use the wininet method if R is newer than 3.3.x so I'll close this. If you feel strongly about it, you can report it at rstudio/rstudio.

hsbadr commented 2 years ago

Thanks @gaborcsardi! It's ok for me; just wanted to let you know. The current version of remotes doesn't have this issue, and it seems that it's already closed in RStudio too: https://github.com/rstudio/rstudio/issues/10163.