[R-SIG-Mac] Corrupt R installation
Simon Urbanek
@|mon@urb@nek @end|ng |rom R-project@org
Fri Jun 11 00:07:38 CEST 2021
Those errors come from packages that you didn't re-install - anything that uses /usr/local is not from CRAN. So check
/Users/Misha/Library/R/4.0/library/
Best way is to move the entire tree aside (Eg. rename "library" to "old") to make sure you don't pick up old stuff.
BTW: you can list packages from a tree even if it's not used by R by using lib.loc, so if you renamed the library as above, you can still list all packages in there by using
pkg=rownames(installed.packages(lib.loc="/Users/Misha/Library/R/4.0/old"))
Cheers,
Simon
PS: just an aside, avoid using RStudio to perform upgrades as it has issues when packages that it is using get upgraded, using R is safer.
> On 11/06/2021, at 10:01 AM, moleps islon <moleps2 using gmail.com> wrote:
>
> Allright - I´m way beyond believing I could save my packages and ended up removing everything (including all versions in R.framework dir.) I reinstalled from CRAN. But there is still something out of the ordinary. After installing some of them : Some work, others (meaning most) display
>
> "Error: package or namespace load failed for ‘tidyr’ in dyn.load(file, DLLpath = DLLpath, ...):
> unable to load shared object '/Users/Misha/Library/R/4.0/library/glue/libs/glue.so':
> dlopen(/Users/Misha/Library/R/4.0/library/glue/libs/glue.so, 6): Library not loaded: /usr/local/opt/r/lib/R/lib/libR.dylib
> Referenced from: /Users/Misha/Library/R/4.0/library/glue/libs/glue.so
> Reason: image not found"
>
> - but the library is listed both when I run installed.packages() from R and when I enter the correct directory from the terminal. Moreover - all privileges are OK within the directory.
>
> I promise I´ll never try another shortcut in updating R--must have taken me better part of a week to try and sort this out.
>
>
>
>
> On Thu, Jun 10, 2021 at 8:34 AM peter dalgaard <pdalgd using gmail.com> wrote:
> Yep. (In the first form, you likely want a stoplist for base and recommended packages.)
>
> You can also base it on a listing of the library directory. This has the advantage that you can fairly easily twiddle it to look at older versions after the upgrade.
>
> > .libPaths()
> [1] "/Library/Frameworks/R.framework/Versions/4.0/Resources/library"
> > list.files("/Library/Frameworks/R.framework/Versions")
> [1] "3.0" "3.1" "3.2" "3.3" "3.4" "3.5" "3.6"
> [8] "4.0" "Current"
> > list.files("/Library/Frameworks/R.framework/Versions/3.6/Resources/library")
> [1] "assertthat" "backports" "base"
> [4] "base64enc" "BH" "bitops"
> [7] "boot" "caTools" "chron"
> ...
> > setdiff(list.files("/Library/Frameworks/R.framework/Versions/3.6/Resources/library"),rownames(installed.packages()))
> [1] "caTools" "dplyr" "plogr" "translations"
>
> (Notice that "translations" is not a package, so a red herring in this context)
>
> -pd
>
> > On 10 Jun 2021, at 00:26 , Simon Urbanek <simon.urbanek using r-project.org> wrote:
> >
> >
> > Um, this is actually a lot easier purely with R - if you want to keep track of your favorite packages it is as simple as
> >
> > pkgs = rownames(installed.packages())
> > writeLines(pkgs, "packages.txt")
> >
> > and oyu have a list of all packages that you can edit if desired. if you ever want to re-install then simply
> >
> > pkgs = readLines("packages.txt")
> > install.packages(pkgs)
> >
> > and if you only want to install missing it's simply
> >
> > missing.pkgs = pkgs[!pkgs %in% rownames(installed.packages())]
> > install.packages(missing.pkgs)
> >
> > All trivially done in R. It is always beyond me why people come up with incredibly convoluted solutions to simple things ..
> >
> > Cheers,
> > Simon
> >
> >
> >
> >> On 9/06/2021, at 8:55 PM, Dr Eberhard Lisse <nospam using lisse.NA> wrote:
> >>
> >> On 08/06/2021 22:46, moleps islon wrote:
> >> [...]
> >>> I have no idea why, but my R installation (Mac OS X - Big Sur)
> >>> automatically updates causing havoc with my libraries each time. My
> >>> Mac is under administration from the university and their software
> >>> center, but they claim it is not their fault - but I still suspect
> >>> them for causing all the trouble.
> >> [...]
> >>
> >> Sounds like Homebrew to me. If so, or anyway, create a file (before
> >> updating) which contains something like
> >>
> >> #!/usr/bin/env Rscript --vanilla
> >> #
> >> # set the Mirror
> >> #
> >> local({
> >> r <- getOption("repos")
> >> r["CRAN"] <- "https://cloud.r-project.org/"
> >> options(repos = r)
> >> })
> >> install.packages(c(
> >> "lubridate",
> >> "tidyverse"
> >> ), dependencies = TRUE)
> >>
> >>
> >> or similar and run it if the additional libraries disappear.
> >>
> >> You can fill this with something like
> >>
> >> grep -h library *R \
> >> |awk -F 'library' '{print $2}' \
> >> |sed 's/(//g;s/)//g' \
> >> |sort -u \
> >> |awk '{print "\"" $1 "\","}'
> >> |sed '$ s/,$//'
> >>
> >> or in a few lines of the language of your choice generate the whole
> >> script. And of course refine to your liking with something like
> >>
> >> find ~/R -name '*.R' -exec grep -h library {} ';' \
> >> ...
> >>
> >> greetings, el
> >>
> >> --
> >> To email me replace 'nospam' with 'el'
> >>
> >> _______________________________________________
> >> R-SIG-Mac mailing list
> >> R-SIG-Mac using r-project.org
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> >
> > _______________________________________________
> > R-SIG-Mac mailing list
> > R-SIG-Mac using r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
> --
> 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
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
More information about the R-SIG-Mac
mailing list