Search code examples
rrepositoryinstall.packages

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!


Solution

  • So, after 4 phone calls and multiple attempts at fixing this problem, my institutional IT department were today able to disable the antivirus block that was preventing R and R Studio from working.

    Apparently, to avoid this in the future, I need to run new programs from a specific folder. So it was the antivirus after all, but I couldn't change the settings from my end as I have a work computer.