Andy
Andy

Reputation: 21

unable to load shared object 'C:/Program Files/R/R-4.0.5/library/stats/libs/x64/stats.dll'

[![ Hi there!!

I am using R 4.0.5 on a windows 10 OS

I have installed rtools40-x86_64 and used the following command to put the location of the make it utilities as recommanded here

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

However after restarting R, it gave me the error on the picture below. or the following

Error: package or namespace load failed for ‘stats’ in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'C:/Program Files/R/R-4.0.5/library/stats/libs/x64/stats.dll':
  LoadLibrary failure:  The specified module could not be found.

During startup - Warning message:
package ‘stats’ in options("defaultPackages") was not found 
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared object 'C:/Program Files/R/R-4.0.5/library/stats/libs/x64/stats.dll':
  LoadLibrary failure:  The specified module could not be found.

I have uninstalled R, RStudio, Rtools, deleted all related files in C, Documents, and RStudio registry, and reinstalled there after. But the same error persist.

In a related post they made mentioned of missing binaries, and I used the command

install.packages("stats", type = "binary")

but it was negative.

I tried updating stats package, but once I call it it gives the same error.

> update.packages("stats")
> library(stats)
Error: package or namespace load failed for ‘stats’ in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'C:/Program Files/R/R-4.0.5/library/stats/libs/x64/stats.dll':
  LoadLibrary failure:  The specified module could not be found.

Every package which requires stats package gives the exact same error.

Does anyone have any idea on how to overcome this challenge?

Thanks in advance. ]3]3

Upvotes: 1

Views: 3739

Answers (3)

James Adler
James Adler

Reputation: 1

I’ve seen many suggestions here and elsewhere suggesting to delete the .Renviron files. I deleted .Renviron locally with no success. However, I found an additional two .Renviron file in my OneDrive folder.

After deleting these files in OneDrive and reinstalling the most recent versions of R and rtools I was able to avoid the ‘stats.dll’ error.

Upvotes: 0

Rupesh Viswanadhan
Rupesh Viswanadhan

Reputation: 1

Go to files. Delete the .Renviron file that you created and it will work.

Upvotes: -1

Andy
Andy

Reputation: 21

I have installed a previous version of R (3.6.0) and a previous version of Rtools (.35) and that message disappeared. I have not tried any other R version.

Upvotes: 0

Related Questions