Peter Dalgaard
2025-Apr-25 16:16 UTC
[R] 4.5.0: Do NOT just copy library folder and update.packages()
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 at cbs.dk Priv: PDalgd at gmail.com
Fer
2025-Apr-25 20:53 UTC
[R] 4.5.0: Do NOT just copy library folder and update.packages()
What about if there is only one folder for packages under 4.X... where any version of R $.X... would load from there the packages? Thanks Fer On 4/25/25 11:16, Peter Dalgaard via R-help wrote:> 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.... >[[alternative HTML version deleted]]
Matthew McCormack
2025-Apr-26 02:48 UTC
[R] 4.5.0: Do NOT just copy library folder and update.packages()
How about this: lib_loc <- "/home/R/x86_64-pc-linux-gnu-library/4.4" to_install <- unname(installed.packages(lib.loc = lib_loc)[, "Package"]) to_install install.packages(pkgs = to_install) ???? Copy the names of the packages, then install them in the new version of R. Matthew On 4/25/25 12:16 PM, Peter Dalgaard via R-help wrote:External Email - Use Caution> 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.... >The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at https://www.massgeneralbrigham.org/complianceline <https://www.massgeneralbrigham.org/complianceline> . Please note that this e-mail is not secure (encrypted). If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately. Continuing to send or respond to e-mail after receiving this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail. [[alternative HTML version deleted]]
Gabor Grothendieck
2025-Apr-26 09:50 UTC
[R] 4.5.0: Do NOT just copy library folder and update.packages()
I used to copy and update but I found that over time my library gets filled with packages that I don't use so now every time a new version of R encounters a package it does not know about I just reinstall it. That keeps my library cleaner. On Fri, Apr 25, 2025 at 12:17?PM Peter Dalgaard via R-help <r-help at r-project.org> wrote:> > 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 at cbs.dk Priv: PDalgd at gmail.com > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com