[R] 4.5.0: Do NOT just copy library folder and update.packages()

Peter Dalgaard pd@me@ @end|ng |rom cb@@dk
Fri Apr 25 18:16:47 CEST 2025


A couple of people have gotten themselves in trouble by copying the contents of their 4.4 library folder into the 4.5 counterpart and running update.packages().

That can be a really bad idea if the old library contains base packages like "tools" or "utils". They don't live on CRAN, so update.packages() just leaves them at the 4.4.x version.

For instance, tools::md5sum has a new bytes= argument in 4.5.0 which gets used when loading other packages, but that cannot work anymore.

So copying library folders was probably never a good idea, but this time it is a very, very bad idea.

To avoid the problem, you can do something like this:

> .libPaths()
[1] "/Library/Frameworks/R.framework/Versions/4.5-x86_64/Resources/library"
> tbl <- installed.packages("/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library")
> table(tbl[,"Priority"])

       base recommended 
         14          15 
> pkglist <- rownames(tbl[is.na(tbl[,"Priority"]),])

and then install.packages(pkglist) avoids touching the base/recommended ones.

- pd

PS: On MacOS, I have two systems upgraded 4.4.x to 4.5.0. One of them has tools in the 4.4 library and the other does not. I have no clue what the difference might be....

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-help mailing list