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

5

11

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!

Deferred answered 2/5, 2020 at 6:51 Comment(22)
Did you check if your antivirus was blocking the connection from RStudio? Run httr::GET("cran.rstudio.com/") and see if Status is 200.Agronomy
Also try downloading the package from cran.r-project.org/src/contrib/lmerTest_3.1-2.tar.gz and installing from Tools > Install Packages, change "Install From" to Package Archive File and select the package downloadedAgronomy
Do you get the same errors when you run R from the console?Trajan
@Agronomy when I run httr::GET("cran.rstudio.com/"), I get Error: package ‘httr’ was installed before R 4.0.0: please re-install itDeferred
Also, I forgot to say, I'm using Windows 10Deferred
@Mohanasundaram, I'm not really sure how to try your second suggestion, when I change to Package Archive File and try to load lmerTests, for instance, there are multiple folders and files for that package, but I can only select 1?Deferred
@RomanLuštrik I got similar errors saying I couldn't connect to the CRAN mirror today in R console today, though yesterday R was working while RStudio was not, so I'm confused by that...Deferred
save the downloaded package in a folder and run install.packages("{#path to the folder}/lmerTest_3.1-2.tar.gz", repos = NULL, type = "source")Agronomy
Thanks @Mohanasundaram, I couldn't get that code to work, but it's a problem with mutliple different packages, not just lmerTest. See next comment for error codes:Deferred
>install.packages("{C:\Users\nwr\Documents\R\win-library\4.0\lmerTest}/lmerTest_3.1-2.tar.gz", repos = NULL, type = "source") Error: '\U' used without hex digits in character string starting ""{C:\U" > install.packages("C:\Users\nwr\Documents\R\win-library\4.0\lmerTest/lmerTest_3.1-2.tar.gz", repos = NULL, type = "source") Error: '\U' used without hex digits in character string starting ""C:\U" > install.packages("C:\Users\nwr\Documents\R\win-library\4.0\lmerTest\lmerTest_3.1-2.tar.gz", repos = NULL, type = "source") Error: '\U' used without hex digits in character string starting ""C:\U"Deferred
use forward slash / instead of \Agronomy
download the package and save it in D: drive if you have id and run install.packages("D:/lmerTest_3.1-2.tar.gz", repos = NULL, type = "source")Agronomy
It is to check whether the problem is with the installation of package or the connection. If it is getting installed, we could be sure that the problem is with the connection.Agronomy
Thanks @Mohanasundaram, rookie mistake with the forward vs back slash!Deferred
That code worked and lmerTest loaded correctly, so it looks like a connection problemDeferred
run curl::has_internet() and check if it is TRUE.Agronomy
I hope you are not using proxy and your firewall is not blocking R and RStudioAgronomy
TRUE in RStudio and consoleDeferred
@Mohanasundaram, re firewall: I don't think so, everything is working fine on another computer using the same networkDeferred
I tried turning the firewall off - it did not fix the problemDeferred
I am still trying to figure out what else could block the connection to the repository.Agronomy
@Agronomy me too! Thanks for all your suggestions so far. I'm leaving my desk now but will check any further responses when I get back in a day or so.Deferred
D
8

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.

Deferred answered 2/6, 2020 at 0:17 Comment(0)
S
13

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.

Steffens answered 7/5, 2020 at 18:59 Comment(2)
Yep, can confirm that is a problem. As a solution for now, what worked for me is using the x64 internet.dll from a previous 3.6.1 installation and copy it to R-4.0.0/modules/x64/ Alternatively, select in RStudio the x86 if x64 is not neededGarfieldgarfinkel
Copying the internet.dll solved the issue for now. ThanksPyromancy
N
9

I fixed that by simply running [each time]:

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

Nonchalance answered 22/3, 2021 at 12:43 Comment(0)
D
8

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.

Deferred answered 2/6, 2020 at 0:17 Comment(0)
D
2

i can confirm that modules\x64\internet.dll quarantined by symantec in my work pc. that is the main problem. I will ring my IT to fix and update the outcome here.

Danziger answered 1/9, 2020 at 3:12 Comment(3)
not symantec, it is protect cylance antivirus quarantine itDanziger
my IT guy told me that internet.dll is a virus and they will go to consult cylance antivirus company. i said to him that i did not think so. i will update this when i get back answers from cylance. cheers.Danziger
my IT guy gave me to use R 3.6.1 which he is confident that it is cleanDanziger
G
0

Install RStudio and R Version With help of IT Team.

Download New Version of R from CRAN

Copy an internet.dll file (which Size should be Up to 5MB) from Existing Version Installed by IT Team on Your System

C:\Program Files\R\R-4.0.3\modules\x64 and

Paste it to C:\Users\MyUser\Documents\R\R-4.1.2\modules\x64 folder of New version

Then Restart RStudio you will not get any error

also you can install any packages

Do not need to make changes into any File like Rprofile and Renv

Or any other Options() Functions

Note: The File Path may be different in your System

Gitt answered 27/1, 2022 at 8:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.