Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load Rcpp package

Tags:

r

rcpp

Due to my company's firewall I am manually installing packages from local. No errors when building the package from terminal, but I get an error when I load the package using library function

 unable to load shared object 'C:/Program Files/R/R-3.6.1/library/Rcpp/libs/x64/Rcpp.dll':
  LoadLibrary failure:  The specified procedure could not be found.

And it also throws a prompt

enter image description here

Any help is appreciated thanks!

Tried:

  1. Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object
  2. https://github.com/r-lib/rlang/issues/306

None of the above seemed to work

like image 791
Ravi Avatar asked Nov 28 '19 08:11

Ravi


2 Answers

I had this issue. I was using R 4.0.0 in RStudio (1.2.5042). I had been using R just fine all morning and continually had this issue all afternoon. I restarted my computer, updated my packages, and confirmed everything worked well on another computer. Finally I updated to R 4.0.2 and my issue resolved.

My binary package was correctly pathed to 4.0/Rcpp. I still don't know what caused the issue, but since this seemed to fix it hope it will for any future folk with this issue!

like image 86
melmo Avatar answered Nov 16 '22 04:11

melmo


There has been a significant change in the build tools used for binary R packages on Windows:

Starting with R 4.0.0 (released April 2020), R for Windows uses a brand new toolchain bundle called rtools40.
https://cran.r-project.org/bin/windows/Rtools/

This means one has to be extra careful to get the correct file when downloading binary packages from CRAN, since packages for build with incompatible build tools will not work. At the time of writing this means:

  • Use the ones for r-oldrel for R 3.6
  • Use the ones for r-release for R 4.0

When this question was asked, R 4.0 was still r-devel.

You do not have to think about this things when using the build in install.packages() instead of manually downloading files from CRAN.

like image 3
Ralf Stubner Avatar answered Nov 16 '22 04:11

Ralf Stubner