Hi Duncan, We haven't investigated yet, but I strongly suspect this is an RStudio issue.
For extra context, RStudio is doing something similar to R's own staged installation here, where the package is initially installed into a _build sub-directory, and then moved to its final intended installation location following a successful installation. This approach can be useful on Windows because, at least in some contexts, it's possible to move a directory from location A to location B, even if files in location B are currently open / in-use in some application. For RStudio, this can help avoid an installation failure when installing a package which is already loaded in the current RStudio R session. In any event, would you be willing to file an issue at https://github.com/rstudio/rstudio/issues so we can properly track and investigate this? It will also be useful to know what version of Windows you're using, just in case the behavior described above depends on the Windows version being used. Thanks, Kevin On Sat, Jun 28, 2025 at 12:22 PM Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > > I'm running RStudio on MacOS Sonoma 14.7.1 on an M4 Macbook. I haven't > updated either RStudio or the OS for several months. > > However, I updated R to version 4.5.0 recently, and to 4.5.1 today. In > both of those versions I'm seeing some strange behaviour when I ask > RStudio to install a package that I'm developing. I haven't seen this > before, and I haven't noticed it in other packages. > > The behaviour I see is that the package is installed > and RStudio restarts the session and runs `library(pkg)`, but it loads > the old version of the package. > > I don't use the devtools option, so RStudio says it is running > > R CMD INSTALL --preclean --no-multiarch --with-keep.source pkg > > If I manually restart the R session and run `library(pkg)` I get the new > one, so it appears that RStudio is loading the package before it is > fully installed. > > Has anyone else seen this? I'd especially like to know if people have > seen it outside of RStudio. I suspect it's a bug there, but as I said, > I haven't updated it recently. > > BTW, I think I know how to stop this in RStudio: In the "Global Options > | Packages | Development" dialog, there's an option "Use alternate > library path when building package". > > If checked, this builds to > > > /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library/_build > > instead of to > > /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library > > then moves the package into place afterwards. I've only seen the > strange behaviour when I have that option checked, which is what makes > me think this is an RStudio bug --- but somehow triggered by something > new in R 4.5.x. > > Duncan Murdoch > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel