Cannot install swirl package on R version 3.6.3

Hi, I am a new learner in R. I want to run install.packages("swirl") on my Rstudio,but do not know why it cannot be installed successfully. The R console below shows how it run in my Rsudio. I copied all of them.

> install.packages("swirl")
Installing package into ‘C:/Users/xiaqu/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependencies ‘desc’, ‘pkgbuild’, ‘rprojroot’, ‘rstudioapi’, ‘askpass’, ‘glue’, ‘magrittr’, ‘stringi’, ‘cli’, ‘crayon’, ‘ellipsis’, ‘evaluate’, ‘pkgload’, ‘praise’, ‘R6’, ‘rlang’, ‘withr’, ‘curl’, ‘jsonlite’, ‘mime’, ‘openssl’, ‘bitops’, ‘stringr’, ‘testthat’, ‘httr’, ‘yaml’, ‘RCurl’, ‘digest’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/desc_1.2.0.zip'
Content type 'application/zip' length 288192 bytes (281 KB)
downloaded 204 KB

Warning in install.packages :
  downloaded length 208896 != reported length 288192
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/pkgbuild_1.0.6.zip'
Content type 'application/zip' length 137446 bytes (134 KB)
downloaded 134 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/rprojroot_1.3-2.zip'
Content type 'application/zip' length 84790 bytes (82 KB)
downloaded 82 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/rstudioapi_0.11.zip'
Content type 'application/zip' length 280124 bytes (273 KB)
downloaded 273 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/askpass_1.1.zip'
Content type 'application/zip' length 64688 bytes (63 KB)
downloaded 63 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/glue_1.4.0.zip'
Content type 'application/zip' length 158233 bytes (154 KB)
downloaded 154 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/magrittr_1.5.zip'
Content type 'application/zip' length 157457 bytes (153 KB)
downloaded 153 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/stringi_1.4.6.zip'
Content type 'application/zip' length 15310634 bytes (14.6 MB)
downloaded 572 KB

Warning in install.packages :
  downloaded length 585728 != reported length 15310634
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/cli_2.0.2.zip'
Content type 'application/zip' length 398098 bytes (388 KB)
downloaded 388 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/crayon_1.3.4.zip'
Content type 'application/zip' length 750103 bytes (732 KB)
downloaded 732 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/ellipsis_0.3.0.zip'
Content type 'application/zip' length 44575 bytes (43 KB)
downloaded 43 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/evaluate_0.14.zip'
Content type 'application/zip' length 76653 bytes (74 KB)
downloaded 74 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/pkgload_1.0.2.zip'
Content type 'application/zip' length 157083 bytes (153 KB)
downloaded 153 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/praise_1.0.0.zip'
Content type 'application/zip' length 19720 bytes (19 KB)
downloaded 19 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/R6_2.4.1.zip'
Content type 'application/zip' length 59310 bytes (57 KB)
downloaded 57 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/rlang_0.4.5.zip'
Content type 'application/zip' length 1130571 bytes (1.1 MB)
downloaded 1.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/withr_2.1.2.zip'
Content type 'application/zip' length 152325 bytes (148 KB)
downloaded 148 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/curl_4.3.zip'
Content type 'application/zip' length 4127840 bytes (3.9 MB)
downloaded 3.9 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/jsonlite_1.6.1.zip'
Content type 'application/zip' length 1165767 bytes (1.1 MB)
downloaded 1.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/mime_0.9.zip'
Content type 'application/zip' length 48395 bytes (47 KB)
downloaded 47 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/openssl_1.4.1.zip'
Content type 'application/zip' length 3971355 bytes (3.8 MB)
downloaded 508 KB

Warning in install.packages :
  downloaded length 520192 != reported length 3971355
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/bitops_1.0-6.zip'
Content type 'application/zip' length 38469 bytes (37 KB)
downloaded 37 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/stringr_1.4.0.zip'
Content type 'application/zip' length 216428 bytes (211 KB)
downloaded 211 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/testthat_2.3.2.zip'
Content type 'application/zip' length 1798862 bytes (1.7 MB)
downloaded 1.1 MB

Warning in install.packages :
  downloaded length 1114112 != reported length 1798862
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/httr_1.4.1.zip'
Content type 'application/zip' length 514122 bytes (502 KB)
downloaded 502 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/yaml_2.2.1.zip'
Content type 'application/zip' length 206545 bytes (201 KB)
downloaded 201 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/RCurl_1.98-1.1.zip'
Content type 'application/zip' length 2988412 bytes (2.8 MB)
downloaded 1.7 MB

Warning in install.packages :
  downloaded length 1802240 != reported length 2988412
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/digest_0.6.25.zip'
Content type 'application/zip' length 249480 bytes (243 KB)
downloaded 243 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/swirl_2.4.5.zip'
Content type 'application/zip' length 349956 bytes (341 KB)
downloaded 341 KB

Warning in install.packages :
  error 1 in extracting from zip file
Warning in install.packages :
  cannot open compressed file 'desc/DESCRIPTION', probable reason 'No such file or directory'
`Error in install.packages : cannot open the connection`

Does it happen several times ?
Did you try again ?

This seems like some downloading transfers that have been not complete. :thinking:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Yes, it happened several times. I already tried it three times and it pop up the same console. :joy: Do you know how to deal with this issue?

No I never encounter it. You could try on another mirror but not sure it is the issue. Could be from your internet connection too.

Sorry - let's see if someone else have an idea.

It is fine! Thanks anyway. I will also check my internet. :slight_smile:

This seems like a connectivity issue indeed, these are some things to try.

  • Choose a different CRAN repository, RStudios repository is a good choice (http://cran.rstudio.com/) or you could choose one that is geographically closer to you.
  • Disable secure download setting.
  • Check if your internet connection has traffic restrictions of some kind, like a firewall, proxy server, etc. This is usually the case when you are at work or school.


I choose one mirror that is close to me, but it still didn't work. I use my own PC at home. So I think the internet connection should be OK? But I am not sure if it is due to some restrictions on the internet in mainland China.
I run the install code again after chaging the mirror. It pops up as below.

> install.packages("swirl")
Warning in install.packages :
  lzma decoding result 10
Installing package into ‘C:/Users/xiaqu/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘swirl’ is not available (for R version 3.6.3)
Warning in install.packages :
  lzma decoding result 10