could not load libraries on Rstudio but R

I have just updated my R (4.0.3) and R studio (1.4.1103) on my uni windows machine. After installing the packages I could not load them on R studio but can on R. I do not understand this. Any ideas why?

this is an example error on Rstudio:

library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’:
.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

on R console:

library("tidyverse")
-- Attaching packages --------------------------------------- tidyverse 1.3.0 --
v ggplot2 3.3.3 v purrr 0.3.4
v
v tidyr 1.1.2 v stringr 1.4.0
v readr 1.4.0 v forcats 0.5.1
-- Conflicts ------------------------------------------ tidyverse_conflicts() --
x dplyr::filter() masks stats::filter()
x dplyr::lag() masks stats::lag()

From what I can gather, it is most likely that your RStudio is pointing to a different installment of R. Can you run R.Version() on both RStudio and R console and see if they are the same?

If you have different versions, just point your RStudio to the version from your console in Tools > Global Option > General > R version

Hi batbr,

Then I would try re-installing the rlang package

It says could not remove the existing rlang:

> install.packages("rlang")
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/rlang_0.4.10.zip'
Content type 'application/zip' length 1193441 bytes (1.1 MB)
downloaded 1.1 MB

package ‘rlang’ successfully unpacked and MD5 sums checked
Warning in install.packages :
  cannot remove prior installation of package ‘rlang’
Warning in install.packages :
  problem copying C:\R\R-4.0.3\library\00LOCK\rlang\libs\x64\rlang.dll to C:\R\R-4.0.3\library\rlang\libs\x64\rlang.dll: Permission denied
Warning in install.packages :
  restored ‘rlang’

The downloaded binary packages are in
	C:\Users\bgaltbalt\AppData\Local\Temp\Rtmpy86cAk\downloaded_packages

However, i do not think it is rlang, because if i try other packages it will show error with other package. Another example:

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

But, it loads on R console. very strange!

perhaps you have same version number but different R installations no less...
What does it show you in Tools / General Options / R ?

The installations look identical. I tried changing the version but it does not help.

any other ideas to test out?

This topic was automatically closed 21 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.

Thanks, vlad_aluas!

I just checked they're showing the same version.