[R] Unusual Error Loading tidyverse

Kevin Thorpe kev|n@thorpe @end|ng |rom utoronto@c@
Thu Oct 7 16:56:05 CEST 2021

I thought I would close the loop on this. It was really weird and I don’t understand everything that went on.

First, it was indeed the case that the main library was not writeable so packages were being installed in a user library.

Here is where it gets confusing to me. Both library paths did appear in .libPaths(). I could not figure out where that was being set since there was no user .Rprofile and Rprofile.site was not modified. To start over I got the user to delete the local library and started R as an administrator and forced installation in the main library with the lib argument. However, even with dependencies=TRUE in install.packages() everything was not getting installed. I then had the user start RStudio as an admin and use the install packages from the menu, again specifying the main library and asking for dependencies. When this was done, many additional packages were then installed that were not installed when running the native R application. Eventually, after that, tidyverse loaded (I realize it is a wrapper to load a bunch of other packages). I also had the user install rms (which we use) and again, various bits did not get installed and had to be manually requested (I don’t remember which ones).

Anyway, in the end we got his system functioning. I realize that running as admin to install packages is probably not best practice, but it was the only way I saw to get things working. I _think_ some of the problems were because his home directory is synced with OneDrive and the user library path was to a OneDrive folder.

I am often shocked by the difficulties students have installing packages. They manage to get errors that I have never seen in all my user of using R. On a Win10 box of my own, I installed R and packages with no difficulties so, naturally am surprised when things go this haywire with an installation.

That’s my story. Hope it was entertaining. :-)


> On Sep 24, 2021, at 3:26 PM, Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
> It is worth checking that the library where things were most recently installed is the first place R looks, i.e. the first entry in .libPaths().  Often R is installed by an administrator, and users can't write to the main library, so when they install packages they go somewhere else.  If "somewhere else" isn't first in .libPaths(), R won't see the new installs.
> Duncan Murdoch
> On 24/09/2021 2:04 p.m., Kevin Thorpe wrote:
>> I did try installing xml2 and it appeared to complete. I will ask him to try again and send me the output.
>>> On Sep 24, 2021, at 1:58 PM, Jeff Newmiller <jdnewmil using dcn.davis.ca.us> wrote:
>>> Seems like they should install the xml2 package before proceeding to load whatever (tidyverse).
>>> This kind of "dependency missing" problem tends to be a recurring problem particularly on Windows but in general when some deeply-embedded dependency fails to load or is removed in preparation for upgrading.
>>> On September 24, 2021 10:40:41 AM PDT, Kevin Thorpe <kevin.thorpe using utoronto.ca> wrote:
>>>> Below is some output from one of my students. I have never seen this error and tried a few things (updating packages for one) but am at a loss to help further. Would appreciate suggestions that I can pass along.
>>>> Here is the error. I tried an install.packages(“xml2”) which appeared to complete but the error persists.
>>>>> library("tidyverse")
>>>> Error: package or namespace load failed for ‘tidyverse’ in library.dynam(lib, package, package.lib):
>>>> DLL ‘xml2’ not found: maybe not installed for this architecture?
>>>> Here is the sessionInfo()
>>>>> sessionInfo()
>>>> R version 4.1.1 (2021-08-10)
>>>> Platform: x86_64-w64-mingw32/x64 (64-bit)
>>>> Running under: Windows 10 x64 (build 19042)
>>>> Matrix products: default
>>>> locale:
>>>> [1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252 LC_NUMERIC=C
>>>> [5] LC_TIME=English_Canada.1252
>>>> attached base packages:
>>>> [1] stats graphics grDevices utils datasets methods base
>>>> loaded via a namespace (and not attached):
>>>> [1] Rcpp_1.0.7 cellranger_1.1.0 pillar_1.6.2 compiler_4.1.1 dbplyr_2.1.1 forcats_0.5.1 tools_4.1.1
>>>> [8] jsonlite_1.7.2 lubridate_1.7.10 lifecycle_1.0.0 tibble_3.1.4 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.11
>>>> [15] reprex_2.0.1 DBI_1.1.1 haven_2.4.3 withr_2.4.2 dplyr_1.0.7 httr_1.4.2 fs_1.5.0
>>>> [22] generics_0.1.0 vctrs_0.3.8 hms_1.1.0 grid_4.1.1 tidyselect_1.1.1 glue_1.4.2 R6_2.5.1
>>>> [29] fansi_0.5.0 readxl_1.3.1 tzdb_0.1.2 tidyr_1.1.3 ggplot2_3.3.5 purrr_0.3.4 readr_2.0.1
>>>> [36] modelr_0.1.8 magrittr_2.0.1 backports_1.2.1 scales_1.1.1 ellipsis_0.3.2 assertthat_0.2.1 colorspace_2.0-2
>>>> [43] utf8_1.2.2 munsell_0.5.0 broom_0.7.9 crayon_1.4.1
>>> -- 
>>> Sent from my phone. Please excuse my brevity.

Kevin E. Thorpe
Head of Biostatistics,  Applied Health Research Centre (AHRC)
Li Ka Shing Knowledge Institute of St. Michael’s Hospital
Assistant Professor, Dalla Lana School of Public Health
University of Toronto
email: kevin.thorpe using utoronto.ca  Tel: 416.864.5776  Fax: 416.864.3016

More information about the R-help mailing list