Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install packages after R update: unable to access index for repository: internet routines cannot be loaded

I use RStudio, and I updated R yesterday to the following version:

R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

Now, I can't connect to any CRAN mirrors (I've tried 4 different ones) or install packages. When I start RStudio, I get the following errors on start up:

Error in tools::startDynamicHelp() : internet routines cannot be loaded
Warning: namespace ‘lme4’ is not available and has been replaced
by .GlobalEnv when processing object ‘lmer1’
Warning: namespace ‘ggplot2’ is not available and has been replaced
by .GlobalEnv when processing object ‘plot1’
Warning: namespace ‘emmeans’ is not available and has been replaced
by .GlobalEnv when processing object ‘.Last.ref_grid’
Warning: namespace ‘pbkrtest’ is not available and has been replaced
by .GlobalEnv when processing object ‘.Last.ref_grid’
[Workspace loaded from C:/Users/xxx.RData]

Loading required package: lmerTest
Loading required package: lme4
Loading required package: Matrix
Error: package or namespace load failed for ‘lme4’:
 package ‘lme4’ was installed before R 4.0.0: please re-install it
Failed with error:  ‘package ‘lme4’ could not be loaded’

Then, when I try to install a package, I get the following message:

Installing package into ‘C:/Users/xxx/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/src/contrib:
  internet routines cannot be loaded
Warning in install.packages :
  package ‘Rtools’ is not available (for R version 4.0.0)
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/4.0:
  internet routines cannot be loaded

I know there are multiple threads on these warnings, but I haven't found a solution to this problem on any of them. Things I've tried already that haven't worked:

  • changing the CRAN mirror setting - I've tried 4 different ones, and the mirrors are working because it works on another computer
  • restarting the program
  • restarting the computer
  • changing the setting in Tools>Global options>Packages so that https is unchecked
  • updating RStudio (though it is also a problem in R as well)
  • uninstalling and reinstalling R 4.0
  • checking the library path - seems correct
  • making Internet Explorer the default browser
  • running the command options(repos='https://cran.rstudio.com/')
  • running the command line install.packages("package name", dependencies=TRUE, repos='http://cran.rstudio.com/')
  • running the command options(download.file.method="libcurl")
  • running the command Sys.getenv("LD_LIBRARY_PATH")

My partner downloaded R 4.0 and RStudio on to his computer and it works fine.

Any suggestions? I'm new to Stack Overflow and pretty new to R, so please, step by step instructions/suggestions where possible!

like image 669
Natalie Roadknight Avatar asked May 02 '20 06:05

Natalie Roadknight


2 Answers

I fixed that by simply running [each time]:

options(download.file.method="wget")

like image 54
Estatistics Avatar answered Oct 14 '22 01:10

Estatistics


I had a similar issue. I recevied the following error on startup

Error in tools::startDynamicHelp() : internet routines cannot be loaded

After investigation, I found my antivirus software has quarantined R-4.0.0/modules/x64/internet.dll. Unfortunately, my antivirus settings are controlled by group policy so I can't disable them to claim a solution.

like image 40
User9986723 Avatar answered Oct 14 '22 00:10

User9986723