Installing package dplyr - error with rlang and other dependencies

Hi Community,

I am currently using R 3.5.1, and RStudio 1.1.453. I have been trying to install dplyr library. The command I use
install.packages("dplyr")

As a part of it, the dependencies should be installed automatically. However, I get an error with a couple of dependencies - like rlang. The copy of the error can be found below:

The message at the end says:
The downloaded source packages are in
‘C:\Users\ngyanch2\AppData\Local\Temp\RtmpCWJPUH\downloaded_packages’

Finally, when I try to load the library dplyr, I get the following error:

library(dplyr)
Error in library(dplyr) : there is no package called ‘dplyr’

So I tried to install rlang as a separate package, which seems to be installed, yet doesn't work:

install.packages("rlang")

There is a binary version available but the source version is later:
binary source needs_compilation
rlang 0.3.4 0.4.11 TRUE

Binaries will be installed
trying URL 'https://cran.uni-muenster.de/bin/windows/contrib/3.4/rlang_0.3.4.zip'
Content type 'application/zip' length 1080437 bytes (1.0 MB)
downloaded 1.0 MB

package ‘rlang’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘C:\Program Files\R\R-3.4.4\library\file2d4044371ff4\rlang’ to ‘C:\Program Files\R\R-3.4.4\library\rlang’

The downloaded binary packages are in
C:\Users\ngyanch2\AppData\Local\Temp\RtmpCWJPUH\downloaded_packages

library(rlang)
Error in library(rlang) : there is no package called ‘rlang’

To me, it also seemed like an issue of mismatching versions of rlang, which prompted me to use the command:

install.packages("https://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.4.10.tar.gz", repos = NULL, type="source")

in the hope of downloading the specific version of rlang. However, that was not fruitful either as i kept getting the same error.

I am facing the same issue for multiple packages, while a friend, working with exactly same configuration is able to run the libraries.

I even tried manually pasting the library in the C drive folder for R, which gives this error:

library(rlang)
Error: package ‘rlang’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
In addition: Warning message:
package ‘rlang’ was built under R version 3.5.3

In the organization there are tight controls around the version of R that we use, so updating the versions is not an option. I still wonder how my friend is able to use the same package with exact same configurations.

Please assist.

Not entirely sure what could be the issue, as the install codes you used worked for me. Personally, I never use code to install packages, it has caused problems in the past. I just go to Tools and Install the packages I'm looking for from CRAN, then it's simply running library(package_name) to call it up. You won't need to install the same package a second time; once installed it's there for good. Perhaps manually installing fixes the problem?

-Q

Is there any reason you are using specifically R 3.5.1? Current version is 4.1.1 and if you have a chance, you should update your R installation and try again.

It seems you are in a version mismatch nightmare, your package library seemed to have been compile under R 3.4.4 but you are using 3.5.1, that can cause problems with incompatible base R packages that do not get updated from CRAN. On Windows each major R version has its own system level package library, I recommend you to use the corresponding R 3.5.1 system level package library instead, if you want you could move your packages from the old library to the new one (just be sure not to overwrite the existing base R packages) and then update your packages with update.packages(checkBuilt = TRUE).

You can change the default library folder by setting your R_LIBS_SITE environmental variable on a .Reviron or .Rprofile file. For example:

# In a .Renviron file you can set it by adding a line like this one with the desired location 
R_LIBS_SITE="C:\\Program Files\\R\\R-4.1.1\\library"

For a more detailed explanation, you can read this blog post

1 Like

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.