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

peter dalgaard pd@|gd @end|ng |rom gm@||@com
Sat Apr 26 11:32:54 CEST 2025


It's still not completely clear what you intend. You should not just add a 4.4-built library to the library path under 4.5, because the API has changed. So packages in the old library may not work, although some might work because they don't use the parts of the API that changed. The library folders are distinct precisely for that reason.

-pd  

> On 26 Apr 2025, at 00.36, Fer <farcego.pi using gmail.com> wrote:
> 
> Sorry, I am copying nothing from any folder to another folder, as per my 
> message. I am surprise I was not clear enough.
> 
> I have my on bash script to make a clean installation from source, but I 
> keep track of my bandwidth usage. So I try to make this stuff once in a 
> time as when I upgrade my SO version or so...
> 
> Don't forget that nowadays you may have to re-install trillions of 
> packages just to make a median difference and plot it.......
> 
> Anyway Thanks Jeff!
> 
> Fer
> 
> On 4/25/25 17:29, Jeff Newmiller via R-help wrote:
>> Don't copy installed packages. There are also periodically changes in the compiler toolchain, and many packages have compiled code in them that can misbehave if you mix old compiled code and new compiled code. The kinds of errors you get can range from minor random answers to crashing R.
>> 
>> The effort required to tiptoe around these problems is more than the benefit of not having to re-install all of your packages. It may work once and the next time you get weird answers that are hard to track down. Why live on the edge?
>> 
>> On April 25, 2025 1:53:28 PM PDT, Fer<farcego.pi using gmail.com> wrote:
>>> 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]]
>>> 
>>> ______________________________________________
>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guidehttps://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
> [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using 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.


-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business SchoolSolbjerg 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