Problems with R 4.0.0 - Windows - "Error: package or namespace load failed for ‘stats’ in inDL(x, as.logical(local), as.logical(now), ...):"

Hi! I have a problem with R 4.0.0. After installed it and set up all the libraries that I use (like tidyverse, tidymodels and so on) a message started to appear in the console. It looks like this:

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.0/library/stats/libs/x64/stats.dll':
  LoadLibrary failure:  No se puede encontrar el módulo especificado.

Durante la inicialización - 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.0/library/stats/libs/x64/stats.dll':
  LoadLibrary failure:  No se puede encontrar el módulo especificado.

I have checked and is correct what it said, that package disappeared. I tried to install the stats package by CRAN with no answer, copying for older R version and the error message still appears.

Can anyone help me with that, please?
Regards

1 Like

Can you just try to uninstall and then a fresh installation?

Hi! Thanks for the answer, I have reinstalled R 4.0.0, change the file directory as is suggested here. I have also removed all the R previous versions that were installed in my PC and the same message still appearing.
Please any help will be highly appreciated due to I don't have R now.

After a major R updated you have to update your packages with

update.packages(ask=FALSE, checkBuilt=TRUE)

Give it a try an see if it helps.

4 Likes

Hi! thanks for your answer.
Trying the command indicated do not launch any changes.
However, I think that I just figure out what happened: Rtools4.0.0 has a created the conflict (here), By changing the PATH, as the instructions suggest, creates a conflict with base R packages. I use this to reset the PATH and that prior message didn't appear anymore.
But, Rtools 4.0.0 sends this message by installing or updating packages:

install.packages("jsonlite", type = "source")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

Did I do something wrong?

I'm having the same problem for the same reasons. How exactly did you reset the PATH? I went to the link but was unsure what I should change the PATH to or how to change it.

1 Like

@ameresv and @Angela_Holland, I just installed R 4.0.0 on my Windows 10 system, and faced no issue.

Steps I followed:

  1. downloading the installers for R and rtools40
  2. installed R and accepted all defaults
  3. installed rtools40 and accepted all defaults
  4. opened Rtools Bash (from Rtools 4.0 folder in start menu)
  5. checked the home for Rtools via this: echo $RTOOLS40_HOME (for me, it was C:\rtools40)
  6. went to the setting of environment variables and added a new entry C:\rtools40\usr\bin for my user

I hope this should work for you two as well.

5 Likes

It works fine. Thanks a lot!

1 Like

The solution here worked for me.

Hi, I followed the steps but the problem persists. In step 6, where we have to change setting of environment variables? I did in my computer properties. Can u suggest solution?

2 Likes