Unable to install rgdal package - r

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

Related

How to install "mxnet" package in R 4.0.2

Good afternoon. Recently I have encountered the problem with installing "mxnet" package. I have tried several variants of code, but neither of their actually installs this package.
1.
cran <- getOption("repos")
cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/15"
options(repos = cran)
install.packages("mxnet")
library(mxnet)
And get the error like this:
Error: package or namespace load failed for ‘mxnet’: package ‘mxnet’
was installed before R 4.0.0: please re-install it
install.packages("https://github.com/jeremiedb/mxnet_winbin/raw/master/mxnet.zip", repos = NULL)
Then I type library(mxnet) and get the error message as in p.1.
3.
cran <- getOption("repos")
cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23"
options(repos = cran)
library(devtools)
require(devtools)
install_version("DiagrammeR", version = "0.9.0", repos = "http://cran.us.r-project.org")
require(DiagrammeR)
install.packages("mxnet")
library(mxnet)
After executing this code I get the following error:
ERROR: failed to lock directory 'C:/Users/user/Documents/R/win-library/4.0' for modifying
Try removing 'C:/Users/user/Documents/R/win-library/4.0/00LOCK-rlang'
Error: Failed to install 'unknown package' from URL:
(converted from warning) installation of package ‘rlang’ had non-zero exit status
> install.packages("mxnet")
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib:
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES'
Installing package into ‘C:/Users/user/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib:
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES'
Warning in install.packages :
package ‘mxnet’ is not available (for R version 4.0.2)
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0:
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES'
In the end, mxnet package hasn't been installed in RStudio yet.
I have familizrized myself with MXNet package installation in R , but some of the instructions, given there, didn't bring any help. Other coincide with my code.
Could you, please, tell me, how to successfully install this package? What code should I run?
Thank you for your effort.
As there is no prebuilt MXNet binary available for the version of R that you are using, you will need to follow the build from source instructions. Please see https://mxnet.apache.org/versions/1.7.0/get_started/build_from_source
You can follow these instructions but use the 1.8.0rc2 release archive instead of 1.7.0 if you like.
This question is duplicate of R: namespace load failed for ‘mxnet’: package ‘mxnet’ was installed before R 4.0.0: please re-install it but can't be flagged as duplicate as there are no accepted answers.

Install R package 'rgdal' and its external dependencies offline on windows

My work laptop has no internet access and I am trying to download the package rgdal.
I have downloaded rgdal_1.4-8.tar.gz, gdal-3.0.4.tar.gz and proj-6.3.2.tar.gz. I tried intalling them via source separately using:
install.packages('.../...tar.gz', type='source', repos=NULL)
but it did not work. Here are the error messages
ERROR: cannot extract package from 'D:/Users/sn/Documents/R source packages/gdal-3.0.4.tar.gz'
Warning in install.packages :
installation of package ‘D:/Users/sn/Documents/R source packages/gdal-3.0.4.tar.gz’ had non-zero exit status
ERROR: cannot extract package from 'D:/Users/sn/Documents/R source packages/proj-6.3.2.tar.gz'
Warning in install.packages :
installation of package ‘D:/Users/sn/Documents/R source packages/proj-6.3.2.tar.gz’ had non-zero exit status
Error in download.file(sprintf("https://github.com/rwinlib/gdal2/archive/v%s.zip", :
cannot open URL 'https://github.com/rwinlib/gdal2/archive/v2.2.3.zip'
In addition: Warning message:
In download.file(sprintf("https://github.com/rwinlib/gdal2/archive/v%s.zip", :
InternetOpenUrl failed: 'A connection with the server could not be established'
Execution halted
make: *** [Makevars.win:27: winlibs] Error 1
ERROR: compilation failed for package 'rgdal'
* removing 'D:/Users/sn/Documents/R/win-library/3.6/rgdal'
Warning in install.packages :
installation of package ‘D:/Users/sn/Documents/R source packages/rgdal_1.4-8.tar.gz’ had non-zero exit status

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.

Can not install package 'swirl' on my rstudio

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)

jsonlite for R gives error when trying to install

Where does one get jsonlite? Apparently it is missing from CRAN?
> install.packages('jsonlite')
Gives:
Installing package into ‘C:/Users/cbusch/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/jsonlite_0.9.20.zip'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/jsonlite_0.9.20.zip': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/jsonlite_0.9.20.zip'
Warning in install.packages :
download of package ‘jsonlite’ failed
Any suggestions?
Like #user5249203 said:
install.packages('jsonlite', dependencies=TRUE, repos='http://cran.rstudio.com/')

Resources