r-lib / remotes

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

prompt user to restart R after installing an already-loaded package? #564

Closed kevinushey closed 3 years ago

kevinushey commented 3 years ago

If a package is already loaded, then re-installing that package can place the user in an awkward state. For example:

> library(remotes)
> remotes::install_github("r-lib/remotes")
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo r-lib/remotes@HEAD
✓  checking for file ‘/private/tmp/RtmpVJnoRE/remotes45f21a6772c3/r-lib-remotes-5d0d9fd/DESCRIPTION’ (372ms)
─  preparing ‘remotes’:
✓  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘remotes_2.2.0.9000.tar.gz’

Installing package into '/Users/kevinushey/Library/R/4.0/library'
(as 'lib' is unspecified)
* installing *source* package ‘remotes’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (remotes)
> packageVersion("remotes")
[1] '2.2.0.9000'
> getNamespaceInfo("remotes", "spec")
     name   version 
"remotes"   "2.2.0" 

Could the install_*() functions check and see if the package to be installed is already loaded in the current R session, and then prompt the user to restart if so? (assuming that the package was installed into a library already part of .libPaths())

jimhester commented 3 years ago

We have logic in pak to do this. I don't think we are planning on adding anything to remotes.