Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing packages in RStudio: error reading from connection

Tags:

r

rstudio

I have recently updated both R (version 3.4.1) and RStudio (version 1.0.143) and I am now unable to install packages from Rstudio.

If I install a package in R directly using install.packages() it works fine.

If I try and install a package in Rstudio using either install.packages() or using the package install menu I get the error below. I have tried a few different packages, and have uninstalled and reinstalled both R and RStudio.

To get the error:

Run:

install.packages("lme4")

Output:

Installing package into ‘E:/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘minqa’, ‘nloptr’, ‘RcppEigen’

Warning in install.packages :
lzma decoding result 10
Error in install.packages : error reading from connection

I am working off my personal computer, below is some of my system info:

Output from options("repos")

$repos
                        CRAN                            CRANextra 
 "https://cran.stat.auckland.ac.nz/" "http://www.stats.ox.ac.uk/pub/RWin" 
 attr(,"RStudio")
[1] TRUE

Output from sessionInfo()

R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_New Zealand.1252  LC_CTYPE=English_New Zealand.1252    
LC_MONETARY=English_New Zealand.1252
[4] LC_NUMERIC=C                         LC_TIME=English_New Zealand.1252    


attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.1 tools_3.4.1   
like image 952
flee Avatar asked Jul 02 '17 04:07

flee


Video Answer


4 Answers

This certainly is an issue with your connection:the proxies you are using and repositories configured in your RStudio. I was getting the same error when I was connected to US VPN from India.I disconnected VPN and restarted RStudio and it worked like a charm!

like image 172
Yogesh Avatar answered Sep 25 '22 15:09

Yogesh


I had the same issue when I tried to install caret.

The best solution is to restart R studio.

Now the install.packages() works fine.

like image 31
Maadesh Sivakumar Avatar answered Sep 23 '22 15:09

Maadesh Sivakumar


Just restart the R studio it works for me.

like image 33
Rashid Kamal Avatar answered Sep 21 '22 15:09

Rashid Kamal


I had the same issue after I misspelled a package name when trying to install it. I restarted R Studio and then it worked.

like image 24
Escherichia Avatar answered Sep 23 '22 15:09

Escherichia