Can not install package 'swirl' on my rstudio - r

I have a problem to install package 'swirl' on my Rstudio. I tried several cran in China and it cannot connect to server every time. Does anyone know any possible reason? *ps:since the stackoverflow does not allow me to post more than one URL link so I cut off a 'h' of from 'http'
install.packages("swirl")
Warning in install.packages :
URL
'http://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES.rds':
status was 'Couldn't connect to server' Warning in install.packages :
URL 'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES.gz':
status was 'Couldn't connect to server' Warning in install.packages :
URL 'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES':
status was 'Couldn't connect to server' Warning in install.packages :
unable to access index for repository
ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib: cannot open URL
'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES' Warning
in install.packages : URL
'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES.rds':
status was 'Couldn't connect to server' Warning in install.packages :
URL 'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES.gz':
status was 'Couldn't connect to server' Warning in install.packages :
URL 'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES':
status was 'Couldn't connect to server' Warning in install.packages :
unable to access index for repository
ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib: cannot open URL
'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES' Warning
in install.packages : package 'swirl' is not available (for R
version 3.4.0) Warning in install.packages : URL
'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/macosx/el-capitan/contrib/3.4/PACKAGES.rds':
status was 'Couldn't connect to server'

Try:
install.packages("swirl", repos="http://cran.rstudio.com/", dependencies=TRUE)

Related

Can't connect to CRAN mirror from RStudio

This is my first post in the stack though this has been my go to option for any coding related issue for a long time. So recently my machine was reconfigured and I had to reinstall with the IT support all my IDEs including R and RStudio. Since then I am getting this vexing issue of installing any new R package and even existing R packages keep throwing error that it's not installed or can't connect to CRAN mirror
> .libPaths()
[1] "H:/My Documents/R/R-3.3.2" "H:/My Documents/R/R-3.3.2/library" "C:/R/R-3.5.3/library"
> .libPaths("C:/R/R-3.5.3/library")
> install.packages("DBI",repos="https://cran.rstudio.com/")
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/src/contrib:
cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/src/contrib:
cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'
Warning in install.packages :
package ‘DBI’ is not available (for R version 3.5.3)
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
I saw this was posted in another thread here:
R - cannot access urls for package installation
I tried all recommendations in here, still couldn't get it fixed. Any idea what else could be broken. Much appreciate your reponse. BTW, I am not an R pro either, just a little bit hands on.

Ignore SSL when installing packages in R

When I try to install a package like this: install.packages("RGtk2")
I get the following error:
Warning in install.packages :
package ‘RGtk2’ is not available (for R version 3.3.2)
Warning in install.packages :
URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3/PACKAGES.gz': status was 'SSL connect error'
Warning in install.packages :
URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3/PACKAGES': status was 'SSL connect error'
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3:
cannot download all files
How can I disable SSL so that my install goes through? I know that normally this would be bad from a security standpoint, but in this case I'm pretty sure that SSL error happens because there is some corporate proxy server that alters a certificate in some way.

Failure to install `mclust` package in R in Windows 10

When I want to install the package mclust, I get the following error:
> install.packages("mclust")
Installing package into ‘C:/Users/hp1/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is
later:
binary source needs_compilation
mclust 5.2.3 5.3 TRUE
Do you want to install from sources the package which needs compilation?
y/n: y
installing the source package ‘mclust’
trying URL 'https://cran.rstudio.com/src/contrib/mclust_5.3.tar.gz'
Content type 'application/x-gzip' length 2792962 bytes (2.7 MB)
downloaded 2.7 MB
* installing *source* package 'mclust' ...
** package 'mclust' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
gcc -m32 -I"C:/PROGRA~1/R/R-32~1.3/include" -DNDEBUG -I"d:/RCompile/r-compiling/local/local323/include" -O3 -Wall -std=gnu99 -mtune=core2 -c init.c -o init.o
gfortran -m32 -O3 -mtune=core2 -c mclust.f -o mclust.o
make: gfortran: Command not found
C:/PROGRA~1/R/R-32~1.3/etc/i386/Makeconf:206: recipe for target 'mclust.o' failed
make: *** [mclust.o] Error 127
Warning: running command 'make -f "Makevars" -f "C:/PROGRA~1/R/R-32~1.3/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-32~1.3/share/make/winshlib.mk" SHLIB="mclust.dll" SHLIB_LIBADD='$(FLIBS)' OBJECTS="init.o mclust.o mclustaddson.o"' had status 2
ERROR: compilation failed for package 'mclust'
* removing 'C:/Users/hp1/Documents/R/win-library/3.2/mclust'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.3/bin/x64/R" CMD INSTALL -l "C:\Users\hp1\Documents\R\win-library\3.2" C:\Users\hp1\AppData\Local\Temp\RtmpiAzB7h/downloaded_packages/mclust_5.3.tar.gz' had status 1
Warning in install.packages :
installation of package ‘mclust’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\hp1\AppData\Local\Temp\RtmpiAzB7h\downloaded_packages’
When digging for solutions on how to fix it, I came across this where the OP says in a comment that the issue was arising due to missing llpack and lblas libraries, which they fixed by installing lapackdev and blasdev packages. But when I try to install these packages, I get error. I checked all my 12 repositories and tried again, but same result.
> install.packages("lapackdev")
Installing package into ‘C:/Users/hp1/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘lapackdev’ is not available (for R version 3.2.3)
> setRepositories(graphics = getOption("menu.graphics"),
+ ind = NULL, addURLs = character())
--- Please select repositories for use in this session ---
1: + CRAN 2: BioC software
3: BioC annotation 4: BioC experiment
5: BioC extra 6: + CRAN (extras)
7: Omegahat 8: R-Forge
9: rforge.net 10: CRAN (extras, https)
11: R-Forge [https] 12: rforge.net [https]
Enter one or more numbers separated by spaces, or an empty line to cancel
1: 1 2 3 4 5 6 7 8 9 10 11 12
> install.packages("lapackdev")
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://www.omegahat.org/R/src/contrib:
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES.gz': HTTP status was '400 Bad Request'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES': HTTP status was '400 Bad Request'
Warning in install.packages :
unable to access index for repository https://R-Forge.R-project.org/src/contrib:
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES'
Installing package into ‘C:/Users/hp1/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://www.omegahat.org/R/src/contrib:
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES.gz': HTTP status was '400 Bad Request'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES': HTTP status was '400 Bad Request'
Warning in install.packages :
unable to access index for repository https://R-Forge.R-project.org/src/contrib:
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES'
Warning in install.packages :
package ‘lapackdev’ is not available (for R version 3.2.3)
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/bin/windows/contrib/3.2/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/bin/windows/contrib/3.2/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://www.omegahat.org/R/bin/windows/contrib/3.2:
cannot open URL 'http://www.omegahat.org/R/bin/windows/contrib/3.2/PACKAGES'
Warning in install.packages :
cannot open URL 'http://www.rforge.net/bin/windows/contrib/3.2/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'http://www.rforge.net/bin/windows/contrib/3.2/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://www.rforge.net/bin/windows/contrib/3.2:
cannot open URL 'http://www.rforge.net/bin/windows/contrib/3.2/PACKAGES'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/bin/windows/contrib/3.2/PACKAGES.gz': HTTP status was '400 Bad Request'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/bin/windows/contrib/3.2/PACKAGES': HTTP status was '400 Bad Request'
Warning in install.packages :
unable to access index for repository https://R-Forge.R-project.org/bin/windows/contrib/3.2:
cannot open URL 'https://R-Forge.R-project.org/bin/windows/contrib/3.2/PACKAGES'
Warning in install.packages :
cannot open URL 'https://www.rforge.net/bin/windows/contrib/3.2/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://www.rforge.net/bin/windows/contrib/3.2/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository https://www.rforge.net/bin/windows/contrib/3.2:
cannot open URL 'https://www.rforge.net/bin/windows/contrib/3.2/PACKAGES'
Same with blasdev:
> install.packages("blasdev")
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://www.omegahat.org/R/src/contrib:
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES.gz': HTTP status was '400 Bad Request'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES': HTTP status was '400 Bad Request'
Warning in install.packages :
unable to access index for repository https://R-Forge.R-project.org/src/contrib:
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES'
Installing package into ‘C:/Users/hp1/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://www.omegahat.org/R/src/contrib:
cannot open URL 'http://www.omegahat.org/R/src/contrib/PACKAGES'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES.gz': HTTP status was '400 Bad Request'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES': HTTP status was '400 Bad Request'
Warning in install.packages :
unable to access index for repository https://R-Forge.R-project.org/src/contrib:
cannot open URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES'
Warning in install.packages :
package ‘blasdev’ is not available (for R version 3.2.3)
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/bin/windows/contrib/3.2/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'http://www.omegahat.org/R/bin/windows/contrib/3.2/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://www.omegahat.org/R/bin/windows/contrib/3.2:
cannot open URL 'http://www.omegahat.org/R/bin/windows/contrib/3.2/PACKAGES'
Warning in install.packages :
cannot open URL 'http://www.rforge.net/bin/windows/contrib/3.2/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'http://www.rforge.net/bin/windows/contrib/3.2/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://www.rforge.net/bin/windows/contrib/3.2:
cannot open URL 'http://www.rforge.net/bin/windows/contrib/3.2/PACKAGES'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/bin/windows/contrib/3.2/PACKAGES.gz': HTTP status was '400 Bad Request'
Warning in install.packages :
cannot open URL 'https://R-Forge.R-project.org/bin/windows/contrib/3.2/PACKAGES': HTTP status was '400 Bad Request'
Warning in install.packages :
unable to access index for repository https://R-Forge.R-project.org/bin/windows/contrib/3.2:
cannot open URL 'https://R-Forge.R-project.org/bin/windows/contrib/3.2/PACKAGES'
Warning in install.packages :
cannot open URL 'https://www.rforge.net/bin/windows/contrib/3.2/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://www.rforge.net/bin/windows/contrib/3.2/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository https://www.rforge.net/bin/windows/contrib/3.2:
cannot open URL 'https://www.rforge.net/bin/windows/contrib/3.2/PACKAGES'
What is going on and how do I get mclust to install?
I am answering my own question as the following solved the issue (i.e., mclust was installed successfully) without needing to install the 2 packages I mention in the question. So, this might help someone facing difficulty install mclust.
I updated R version from 3.25 to 3.4, and R studio version from 0.9 to the latest (1.0.143 at the time of writing this answer), and this seems to have solved the issue.

R - cannot access urls for package installation

I recently installed R Studio (Version 0.99.892) on a personal computer (windows 8) and am trying to install, among others, the following packages:
ggplot2;
dplyr;
rmarkdown;
tidyr.
Neither R nor R Studio is able to install any of these packages. Each time I attempt to install a package, I get the set of warnings I include at the bottom of this post.
I have used the install.packages command as well as the built-in package installation tool. I have tried several different mirrors.
I have tried a public university internet source, my own private internet source, and a phone tether. I have tried to connect through a VPN. I have added R Studio to my Windows Firewall exception list and have also completely disabled the Windows Firewall. I am running no other firewalls.
I have toggled the various connection options in the "Packages" tab in Global Options.
I can access the URLs in a browser.
Here are the warnings from R Studio:
> install.packages("devtools")
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://cran.fhcrc.org/src/contrib:
cannot open URL 'https://cran.fhcrc.org/src/contrib/PACKAGES'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Installing package into ‘C:/Users/Nikhailovich/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://cran.fhcrc.org/src/contrib:
cannot open URL 'https://cran.fhcrc.org/src/contrib/PACKAGES'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Warning in install.packages :
package ‘devtools’ is not available (for R version 3.2.3)
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://cran.fhcrc.org/bin/windows/contrib/3.2:
cannot open URL 'https://cran.fhcrc.org/bin/windows/contrib/3.2/PACKAGES'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/PACKAGES'
Here are the warnings from R (3.2.3):
> install.packages("ggplot2")
Installing package into ‘C:/Users/Nikhailovich/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'
In addition: Warning message:
In download.file(url, destfile = f, quiet = TRUE) :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning: unable to access index for repository https://dirichlet.mat.puc.cl/src/contrib:
cannot open URL 'https://dirichlet.mat.puc.cl/src/contrib/PACKAGES'
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Warning: unable to access index for repository https://dirichlet.mat.puc.cl/bin/windows/contrib/3.2:
cannot open URL 'https://dirichlet.mat.puc.cl/bin/windows/contrib/3.2/PACKAGES'
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/PACKAGES'
Warning message:
package ‘ggplot2’ is not available (for R version 3.2.3)
There are several stackexchange posts on package installation in R and R Studio, but I was not able to find any that answered my particular situation. Thanks in advance to anyone that knows what's going on
Run this command:
options(repos="https://CRAN.R-project.org")
after that try install.packages;it should work.Tested on my system.
This has happened to me before. Try explicitly specifying the location:
install.packages("devtools", repos="https://cran.rstudio.com/")
You can indeed specify the location when using the install.packages() function with the argument repos=, but you can also choose your favorite repository which will be used each time you download a package.
options(repos="my_favorite_CRAN_mirror")
You can see a list of all availables mirrors on the CRAN website. Juste copy/paste the adress of the closest CRAN repository to you.
You should be able after this step to retry install.packages('ggplot2')
You should try following code:
install.packages("ggbiplot",dependencies = TRUE, repos = 'http://cran.rstudio.com/')
It will help you to install the packages for the error:
package is not available for this version
Run the following command in R terminal-
options(repos="https://CRAN.R-project.org")
then-
use-install.packages('library')
I want to add that I had this issue, but the fix was not in R, but in our system. Our IT guy said: For some unknown reason, the DNS resolver service was unable to resolve hostnames. I’ve restarted the resolvd service. The server can now resolve hostnames.
The error on his end was: Temporary failure in name resolution
I was having a similar error while trying to install the packages dplyr, tidyr packages.
I solved the issue by checking my R.version and downloading a new version of base R. (3.3.3)
Try this...
Tools-->Global Option--> Package
Change "Primary CRAN Repository" to htpps Location
This method fixed my issue

Unable to install rgdal package

I have to work with shapefiles and to convert these to rasters the package rgdal is recommended, however the package is not recognized (R v2.11, RStudio 0.98.501, Mac OS X 10_7_5). How could I still install rgdal or omit this package?
To clarify my question more, the error messages are:
> install.packages("rgdal")
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/macosx/leopard/contrib/2.11
Warning in install.packages :
argument 'lib' is missing: using '/Users/myname/Library/R/2.11/library'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/macosx/leopard/contrib/2.11
Warning in install.packages :
package ‘rgdal’ is not available

Resources