Unable to load certain packages in User Library on new installation

Issue: Unable to load certain packages in User Library

Version: R-4.1.2 [64bit] ; R-4.1.2 [32bit] ; R-41~1.2 [64bit] ; R-41~1.2 [32bit] ; Rstudio 2021.09.1 Build 372

Setup:

  • New installation on Working PC environment. Restriction placed, for example require to adjust proxy server setting in order to connect and install packages.
  • Library path:
    (1) lib.loc = C:/Program Files/R/R-4.1.2/library
    (2)C:\Users\ALONG\Documents\R\win-library\4.1

For example: either using

> library(readxl)
Error: package or namespace load failed for ‘readxl’:
 .onLoad failed in loadNamespace() for 'Rcpp', details:
  call: new_dummyObject(.dummyInstancePointer)
  error: object 'class__dummyInstance' not found

This is the same error, if user is to use the Rstudio user interface {Environment>Import Dataset>From Excel}

Similar error occurs for other packages

> library(ggplot2)
Error: package or namespace load failed for ‘ggplot2’:
 .onLoad failed in loadNamespace() for 'rlang', details:
  call: NULL
  error: The rlang package is not properly installed.
The DLL version does not correspond to the package version.
Please update rlang to the latest version.
Updating packages on Windows requires precautions:
  <https://github.com/jennybc/what-they-forgot/issues/62>

This suggests you have to update or reinstall Rcpp try

install.packages("Rcpp")

Do you get any error message?

And this suggests you need to reinstall rlang try

install.packages("rlang")

Do you get any error message?

For RCPP, i get the following error message

> install.packages("Rcpp")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/ALONG/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/Rcpp_1.0.8.zip'
Content type 'application/zip' length 3317916 bytes (3.2 MB)
downloaded 3.2 MB

package ‘Rcpp’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\ALONG\AppData\Local\Temp\Rtmp8GfIr6\downloaded_packages

For rlang

> install.packages("rlang")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/ALONG/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/rlang_1.0.1.zip'
Content type 'application/zip' length 1610900 bytes (1.5 MB)
downloaded 1.5 MB

package ‘rlang’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\ALONG\AppData\Local\Temp\Rtmp8GfIr6\downloaded_packages

The thing is on my home PC the readxl function work by default , but in the work fresh install it gives error.

Maybe you have the package installed on your both package library locations and since the system level package library is ranking first, that installation is the one it is giving you problems and not the one located here

Check on that and set your default package library accordingly, have in mind that for updating your system-level package library you need to run RStudio as "administrator".

It does not appear there is duplicate since

> .libPaths()
[1] "C:/Users/ALONG/Documents/R/win-library/4.1" "C:/Program Files/R/R-4.1.2/library"
> a -> installed.packages(lib.loc= "C:/Users/ALONG/Documents/R/win-library/4.1")
> b<-installed.packages(lib.loc= "C:/Program Files/R/R-4.1.2/library")
> a[1] %in% b[1]
[1] FALSE

where 1st column of a and b are the respective packages name in each of the directory and it is return false

pardon there is a typo i made, and when i copy and paste i was trying to avoid pasting the error.

this missing line as as follows

> a -> installed.packages(lib.loc= "C:/Users/ALONG/Documents/R/win-library/4.1")
Error: object 'a' not found
> a <- installed.packages(lib.loc= "C:/Users/ALONG/Documents/R/win-library/4.1")

pardon i just realized there is something off with the code above as a[1] is not correct

> a[,1]%in%b[,1]
  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 [20] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 [39] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 [58] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 [77] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 [96] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> b[,1]%in%a[,1]
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
[20] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

should have been the column 1; and they all return FALSE

And by the way thank you for replying. Right now I am trying to see if our helpdesk can try to install packages as I dont have "Administrator" access.

By the way would you know what are some good documentation reference relating to this?

Thank you @andresrcs

A clear reinstallation with the administrator installing the package in the system library seems to resolve the issue

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.