7

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

Ravi
  • 612
  • 1
  • 6
  • 17
  • Can you show us how you installed the package? Did you install from a binary package or from a source package? If binary: Which one did you use? – Ralf Stubner Nov 28 '19 at 08:24
  • @RalfStubner I used the binary package. https://cran.r-project.org/bin/windows/contrib/4.0/Rcpp_1.0.3.zip – Ravi Nov 28 '19 at 08:27
  • 6
    That binary package is for R-devel (which will be R 4.0), while you are using R 3.6. You should be using https://cran.r-project.org/bin/windows/contrib/3.6/Rcpp_1.0.3.zip – Ralf Stubner Nov 28 '19 at 08:29
  • @RalfStubner Consider posting as an answer. – zx8754 Jul 17 '20 at 06:15
  • 1
    @zx8754 Finally got around to that. thanks for the reminder. – Ralf Stubner Aug 09 '20 at 09:22

2 Answers2

3

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!

melmo
  • 757
  • 3
  • 15
3

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.

Ralf Stubner
  • 26,263
  • 3
  • 40
  • 75